Page 1 of 1

Compiling Windows Binaries on Linux Problem

PostPosted: Thu Aug 18, 2016 04:23
by TheReaperKing
Howdy! I am admittedly a Linux noob but for the life of me I cannot get the Windows Binaries to build on Linux. I have been using the buildbot 32bit script. I realized too that I needed to change the mingw references in toolchain_mingw.cmake so I changed it from the default to:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
## SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)


So that actually got it compiling but it errors with
gui10SGUITTFaceD1Ev]+0x23): undefined reference to `__imp_FT_Done_Face'
cguittfont/libcguittfont.a(xCGUITTFont.cpp.obj):xCGUITTFont.cpp:(.text$_ZN3irr3gui10SGUITTFaceD0Ev[_ZN3irr3gui10SGUITTFaceD0Ev]+0x23): undefined reference to `__imp_FT_Done_Face'
collect2: error: ld returned 1 exit status
src/CMakeFiles/minetest.dir/build.make:5521: recipe for target '../bin/minetest.exe' failed
make[2]: *** [../bin/minetest.exe] Error 1
CMakeFiles/Makefile2:221: recipe for target 'src/CMakeFiles/minetest.dir/all' failed
make[1]: *** [src/CMakeFiles/minetest.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2


Not sure if that error message helps but I did also notice that it said it was missing these packages:
Doxygen
GetText
SpatialIndex
Redis
Ncurses
PostgreSQL

I was able to easily get Doxygen and GetText from the Ubuntu Software Center and the other ones I tried to use the Synaptic Package Manager but besides Doxygen, and GetText, they still all say they are missing even though I've tried to install all the library packages and anything else relevant I can find for them.

Any help would be greatly appreciated and I'm hoping to install the 64 bit Win Binaries eventually too so any help there would be great! Thanks for your time!
-Mike
PS I am using Lubuntu 16.04

Re: Compiling Windows Binaries on Linux Problem

PostPosted: Thu Aug 18, 2016 14:40
by Laser0073
I'm kinda a noob too, but it seems to me that you should just edit the source, and then compile it on your windows pc. This way, you wind up with a binary that is custom made for you. Otherwise, just download MT from the offical site. They have versions for Mac, Linux, and Windows, all precompiled.

Re: Compiling Windows Binaries on Linux Problem

PostPosted: Thu Aug 18, 2016 16:26
by kaen
I haven't played with cross-compilation in a couple years, and have never done it with minetest. That said, it looks like a pretty standard missing library error. You might have to download and cross-compile the libraries that minetest depends on (at least anything it links to dynamically). You may also need to change the paths searched by FIND* according to this page: http://www.vtk.org/Wiki/CmakeMingw#How_ ... or_Windows

Finally, here's a working example of a CMake toolchain file I wrote long ago for a completely different project that is known to work: https://github.com/bitfighter/bitfighte ... gw64.cmake

(also consider using mingw-64 which is a more update to date version of mingw-32)

EDIT: Ah, I looked at the file/script you mentioned and in fact all of the above is already being done for you by the scripts. I did notice the lib versions are different between the 32 and 64 bit buildbot scripts, so it could just be a missing symbol added in a later version. If that's not the problem, then there might just be a directory resolution problem and you should confirm that cmake is looking for headers/libs in the location where the build script is dropping them.

Re: Compiling Windows Binaries on Linux Problem

PostPosted: Thu Aug 18, 2016 16:55
by BrandonReese
I had a similar error. I'm trying to remember I think it was a missing freetype library or something like that. I disabled freetype instead of actually fixing it :)

Re: Compiling Windows Binaries on Linux Problem

PostPosted: Thu Aug 18, 2016 22:34
by TheReaperKing
This morning I did identify it as the ncurses library that was causing that specific error. I do have the files in user/include but I have unsuccessfully figured out how to link them as of yet. I'm not sure the proper syntax but I'll be sure to look at your links. Thank you so much for the insight! This is my current toolchain_mingw.cmake that needs love.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
# name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)

# here is the target environment located
## SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
link_directories(/user/include)


EDIT I was thinking too, I know that for another project one of my friends would just compile the Windows Binaries in codeblocks through wine. That might end up being easier. For me I'm also super interested in learning. I think the idea of being able to easily build Windows Binaries on Linux would be awesome. Thanks again for your insight!

Re: Compiling Windows Binaries on Linux Problem

PostPosted: Sat Aug 20, 2016 20:06
by est31
You can simply disable ncurses if its too much trouble. ncurses is only used for headless server operation. Most likely you won't need it.