|
Cross compiling on linux part x |
amarillion
Member #940
January 2001
|
After previous issues I'm giving cross-compilation another go. First I had trouble cross-compiling with allegro 4, so I switched to a5. Then some issues with directX. Then I almost got it except for a missing freetype dependency, but then I switched to C++11 - I knew that would bite me somewhere, because the progress I made with cross-compilation was gone. It turns out I was using the mingw32 debian package and the gcc version it contains is too old. The mingw-w64 package has a newer version. So starting again with mingw-w64: sudo apt-get install mingw-w64 dpkg -l mingw-w64 > mingw-w64 3.1.0-1 i686-w64-mingw32-gcc -v > gcc version 4.8.2 (GCC) cd ~/prg/alleg/allegro-5.0.10/ mkdir Build/Mingw cd Build/Mingw cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-mingw.cmake ../.. But cmake stops with the following error CMake Error at CMakeLists.txt:620 (message): Windows port requires DirectInput (not found). According to Elias in this thread, the mingw-w64 package comes with the required directx headers, but apparently not? wget http://alleg.sourceforge.net/files/dx9mgw.zip ## NOTE this link is currently dead, but I had an older copy unzip -a dx9mgw.zip sudo cp -r dx9mgw/* /usr/i686-w64-mingw32/ However, that doesn't solve the problem at all, I still get the above DirectInput not found error So here are my questions: edit: I just tried with allegro 5.1.11 as well and still get the same error. -- |
Elias
Member #358
May 2000
|
1. It was not legal to redistribute, and it's outdated and not needed anymore. apt-get install mingw-w64-x86-64-dev In cmake, you can hardcode the following (cmake sometimes randomly decides to not find stuff): D3D9_INCLUDE_DIR:PATH=/usr/i686-w64-mingw32/include D3D9_LIBRARY:FILEPATH=/usr/i686-w64-mingw32/lib/libd3d9.a D3DX9_INCLUDE_DIR:PATH=/usr/i686-w64-mingw32/include D3DX9_LIBRARY:FILEPATH=/usr/i686-w64-mingw32/lib/libd3dx9_42.a DINPUT_INCLUDE_DIR:PATH=/usr/i686-w64-mingw32/include DINPUT_LIBRARY:FILEPATH=/usr/i686-w64-mingw32/lib/libdinput8.a DSOUND_INCLUDE_DIR:PATH=/usr/i686-w64-mingw32/include DSOUND_LIBRARY:FILEPATH=/usr/i686-w64-mingw32/lib/libdsound.a All those files come with mingw. -- |
SiegeLord
Member #7,827
October 2006
|
Maybe it doesn't find it because the toolchain file doesn't set the CMAKE_FIND_ROOT_PATH for the '/usr/i686-w64-mingw32' case. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
amarillion
Member #940
January 2001
|
@Siegelord, you're right! If I do cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-mingw.cmake -DCMAKE_FIND_ROOT_PATH=/usr/i686-w64-mingw32 -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 ../.. ... -- Found DINPUT: /usr/i686-w64-mingw32/include -- Found D3D9: /usr/i686-w64-mingw32/include -- Found D3DX9: /usr/i686-w64-mingw32/include -- Found DSOUND: /usr/i686-w64-mingw32/include ... and it works. (edit: I added CMAKE_INSTALL_PREFIX as well because the files got installed to the wrong location) @Elias, sorry for my ignorance about cmake, but I don't know where to add those definitions. It's moot now but I still would like to know what you meant, so I can figure out cmake next time. I've been reading up on cmake documentation. The docs explain well enough how to instruct cmake to build various things, but what I'm missing is some documentation that explains what cmake actually does under the hood (so that you can troubleshoot it when it goes wrong) -- |
Elias
Member #358
May 2000
|
I only know how to set it in cmake-gui myself. There you first have to find the small "Advanced" checkbox, and then I usually use the search field to navigate. I just grepped CMakeCache.txt for "/usr/i686-w64-mingw32" to get my list. -- |
pkrcel
Member #14,001
February 2012
|
Well, once you run cmake with those "-D" options they gest "saved" in cmakecache, so there is non need to specify those on another run, just like you set them in cmake-gui. At least it's how I always It is unlikely that Google shares your distaste for capitalism. - Derezo |
Thomas Fjellstrom
Member #476
June 2000
|
The new location for mingw should probably be added to the big chain of IFs in the mingw toolchain file. OR alternatively, we change that big chain of IFs into some kind of more intelligent GLOB looking for mingw and the compiler executable in a more generic way. -- |
amarillion
Member #940
January 2001
|
Looking at the code of Toolchain-mingw.cmake, it looks like there is a bug not defining CMAKE_FIND_ROOT_PATH just for /usr/i686-w64-mingw32. I'll see if I can make a pull request. -- |
Thomas Fjellstrom
Member #476
June 2000
|
amarillion said: Looking at the code of Toolchain-mingw.cmake, it looks like there is a bug not defining CMAKE_FIND_ROOT_PATH just for /usr/i686-w64-mingw32 I don't know I'd call it a bug. It's a pretty brain-dead detection setup. See if you can't get it to find any mingw cross compiler installed -- |
amarillion
Member #940
January 2001
|
Not sure what you mean, to me it seems there is just a line missing. I created a pull request -- |
Thomas Fjellstrom
Member #476
June 2000
|
Ah I see. I misread. I thought the compiler was in a different location as any of the ones in the toolchain file. The current setup is a little fragile. -- |
amarillion
Member #940
January 2001
|
Probably true, but I'm not yet confident enough with cmake to perform major surgery -- |
|