Closed SteelT1 closed 6 years ago
You need to install zlib. https://zlib.net/
If that doesn't fix the issue, tell me. Otherwise, I'll close this in a few days.
After installing zlib and changing the compile flags to -Wl,-lz
it linked just fine.
Huh, I guess I'll try it out in mingw. Are you doing it on windows, or cross compiling targetting windows?
And is this mingw32? or mingw-w64?
I also suspect but cannot yet confirm that using the MinGW toolchain that is offered in the cygwin setup wizard would solve this problem, too.
Windows, mingw-w64.
OK, I think I've fixed building in windows. Delete your cmakecache.txt, do a git pull, and try again. I'll close this in a few hours if it fixed it.
I tested it in Windows 7, with Cygwin, using a Mingw-w64 toolchain and this command:
cmake -DCMAKE_TOOLCHAIN_FILE=~/crosscompile.cmake ..
With this cross-compilation script (crosscompile.cmake
):
# this one is important
SET(CMAKE_SYSTEM_NAME Windows)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
set(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32/sys-root/mingw)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Initially, I had the same problem you described. After adding a condition for WIN32 builds to disable the sanitizer library (which did not work in Windows), and altering one other line relating to the linker, it built.
(should be fixed in 1a9879f)
Sorry for late update, kinda forgot about it. But I can confirm it works
@SteelTitanium Thanks. I'll close this one, then.
It compiles just fine, but when attempting to link. It errors out with
ld.exe: unrecognized option '-z'