-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
On v3.2.6, mingw build is failing. Using the toolchain file:
# toolchain-mingw64.cmake
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
# specify the cross compiler
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)
# where is the target environment
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
# 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)cmake -B build -DCMAKE_TOOLCHAIN_FILE=../../toolchain-mingw64.cmake
cmake --build buildFails with the error:
[ 84%] Building CXX object src/libdbcppp/CMakeFiles/libdbcppp.dir/SignalImpl.cpp.obj
In file included from /home/stephk/Projects/dbcppp-builder/submodules/dbcppp/src/libdbcppp/SignalImpl.cpp:2:
/home/stephk/Projects/dbcppp-builder/submodules/dbcppp/src/libdbcppp/Helper.h:40:13: fatal error: byteswap.h: No such file or directory
40 | # include <byteswap.h>
| ^~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [src/libdbcppp/CMakeFiles/libdbcppp.dir/build.make:302: src/libdbcppp/CMakeFiles/libdbcppp.dir/SignalImpl.cpp.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:312: src/libdbcppp/CMakeFiles/libdbcppp.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2
This can be fixed with the following patch:
diff --git a/src/libdbcppp/Helper.h b/src/libdbcppp/Helper.h
index ef98c1e..2f5999d 100644
--- a/src/libdbcppp/Helper.h
+++ b/src/libdbcppp/Helper.h
@@ -8,7 +8,7 @@
#include "EndianConfig.h"
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# include <stdlib.h>
# define bswap_32(x) _byteswap_ulong(x)
# define bswap_64(x) _byteswap_uint64(x)It works from v3.2.6, but it is failing due to #148 from master branch.
Metadata
Metadata
Assignees
Labels
No labels