aescande / log4cxxWin32

Helpers to build log4cxx on Windows
3 stars 10 forks source link

Building with msys264 & mingw64 (gcc 8.2) #1

Open yRezaei opened 5 years ago

yRezaei commented 5 years ago

First of all thanks a lot for sharing your solution. After a long search, this was the only project that compiled and worked perfectly with VS2017.

My problem is that I forced to build log4cxx with GCC in windows and whatever I tried haven't worked so far. Only with the CMakeLists.txt file that you are provided, I managed to build apr.a, apr-util.a, and XML.a Unfortunately, the log4cxx has some wired issue. The first issue is: In file included from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/guiddef.h:149, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/winnt.h:635, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/minwindef.h:163, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/windef.h:8, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/windows.h:69, from D:/libs/log4cxx/log4cxxWin32/cmake/build-gcc/apr.h:98, from D:\libs\log4cxx\log4cxxWin32\apr\file_io\win32\filepath.c:17: C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/string.h:119: note: this is the location of the previous definition

define strncasecmp _strnicmp

[ 5%] Building C object CMakeFiles/apr.dir/D_/libs/log4cxx/log4cxxWin32/apr/file_io/win32/filestat.c.obj C:\PROGRA~1\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe @CMakeFiles/apr.dir/includes_C.rsp -DAPR_DECLAREEXPORT -DWINNT -o CMakeFiles\apr.dir\D\libs\log4cxx\log4cxxWin32\apr\file_io\win32\filestat.c.obj -c D:\libs\log4cxx\log4cxxWin32\apr\file_io\win32\filestat.c In file included from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/objbase.h:66, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/ole2.h:17, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/wtypesbase.h:12, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/wtypes.h:22, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/accctrl.h:10, from C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/aclapi.h:14, from D:\libs\log4cxx\log4cxxWin32\apr\file_io\win32\filestat.c:18: C:/PROGRA~1/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/objidl.h:10935:9: error: unknown type name 'CLIPFORMAT' typedef CLIPFORMAT *LPCLIPFORMAT;

I got rid of this issue by commenting out the "#include " which is included in the header file "mingw64\x86_64-w64-mingw32\include**wtyps.h**".

The second issue is with a weird error is: ... ... [ 48%] Building CXX object CMakeFiles/log4cxx.dir/D_/libs/log4cxx/log4cxxWin32/log4cxx/src/main/cpp/action.cpp.obj C:\PROGRA~1\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe -Dlog4cxx_EXPORTS @CMakeFiles/log4cxx.dir/includes_CXX.rsp -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE /wd4101 /wd4250 /wd4251 /wd4275 /wd4355 -O3 -DNDEBUG -D_USRDLL -DDLL_EXPORTS -DLOG4CXX -DAPR_DECLARE_STATIC -DAPU_DECLARE_STATIC -DAPR_DECLARE_EXPORT -DWINNT -DAPI_DECLARE_STATIC -DAPU_USE_SDBM -DHAVE_SQL_H -DXML_STATIC -DCOMPILED_FROMDSP -o CMakeFiles\log4cxx.dir\D\libs\log4cxx\log4cxxWin32\log4cxx\src\main\cpp\action.cpp.obj -c D:\libs\log4cxx\log4cxxWin32\log4cxx\src\main\cpp\action.cpp g++.exe: error: /wd4101: No such file or directory g++.exe: error: /wd4250: No such file or directory g++.exe: error: /wd4251: No such file or directory g++.exe: error: /wd4275: No such file or directory g++.exe: error: /wd4355: No such file or directory

any idea how to solve this one?

twdragon commented 4 years ago

I get rid of the first error by deep patching the project itself. Now I am working on this. I think, this is a kind of jrl-cmakemodules issue

twdragon commented 4 years ago

There are some issues with MSVC pragmas in the source, so to avoid the error, you should just patch makefiles after CMake ends:

sed -i -e 's/\/wd4101\ \/wd4250\ \/wd4251\ \/wd4275\ \/wd4355//' "${BUILD_DIR}/CMakeFiles/log4cxx.dir/link.txt"
sed -i -e 's/\/wd4101\ \/wd4250\ \/wd4251\ \/wd4275\ \/wd4355//' "${BUILD_DIR}/CMakeFiles/log4cxx.dir/flags.make"