dbus git : compilation failure (windows MSYS2 + mingw-w64, cmake)
Hello
for a autotooled project, unit tests need dbus-run-session on Windows. It seems that git dbus has an implementation. So i tried to compile it with cmake (autotools have errors with the AX_* macros...).
First, i don't know much about cmake. Second, to have a coherent set of dependencies, i've compiled all the dependencies of the project mysel, including iconv (win-iconv) and expat, which are dependencies of git dbus. The are all installed in /opt/ewpi_32/ Third, iconv and expat have already been installed by previously installed packages (certainly the i686 mingw-w64 toolchain) in /mingw32/
my cmake command (after creating a subdir and entering it) :
cmake -DCMAKE_INSTALL_PREFIX=/opt/dbus -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Unix Makefiles" -DEXPAT_INCLUDE_DIR=/opt/ewpi_32/include -DLIBICONV_INCLUDE_DIR=/opt/ewpi_32/include -DLIBICONV_LIBRARIES=iconv -DCMAKE_C_FLAGS="-I.. -I../.. -I../builddir" -DCMAKE_CXX_FLAGS="-I.. -I../.." ..
output for iconv and expat : a) there is no iconv output since i have added -DLIBICONV_INCLUDE_DIR=/opt/ewpi_32/include -DLIBICONV_LIBRARIES=iconv
but... iconv appears nowhere in code ('git grep iconv' shows at least nothing in source code)
b) -- Found EXPAT: D:/Documents/msys2/opt/ewpi_32/lib/libexpat.dll.a (found version "2.2.5")
My questions / remarks :
- I have to add myself -DCMAKE_C_FLAGS="-I.. -I../.. -I../builddir" -DCMAKE_CXX_FLAGS="-I.. -I../.." otherwise some header files are not found
I think that the current configuration done by cmake is not complete. As a user, i shouldn't have to set CMAKE_C_FLAGS and CMAKE_CXX_FLAGS. This is the job of the build system (cmake, here), not mine.
-
Should the check of iconv be dropped in CMakeList.txt ?
-
i then run 'make'. When creating gbus-daemon.exe, I have a link error : /mingw32/bin/i686-w64-mingw32-gcc.exe -I.. -I../.. -I../builddir -Wsign-compare -O3 -DNDEBUG -Wl,--whole-archive CMakeFiles/dbus-daemon.dir/objects.a -Wl,--no-whole-archive -o ../bin/dbus-daemon.exe -Wl,--out-implib,../lib/libdbus-daemon.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/dbus-daemon.dir/linklibs.rsp D:/Documents/msys2/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.4.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lD:/Documents/msys2/opt/ewpi_32/lib/libexpat.dll.a
What is passed to -l is wrong, instead of passing -LD:/Documents/msys2/opt/ewpi_32/lib -lexpat
does someone know why there is this error ? are my expat flags passed to cmake wrong ?
thank you
Vincent Torri