Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building with MinGW-w64 toolchain #2093

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PatrickM-ZS
Copy link
Contributor

This should fix #2051. Thanks to @e-tmplr!

I've added a Dockerfile for Linux with a cross-compile toolchain. It builds, but I've not had much success running the binaries through wine. 32-bit crashes with illegal memory access, 64-bit runs but complains about malformed packets and outputs some gibberish. Maybe due to wine bugs, bad configuration, or perhaps there's something more serious. But that could be fixed on a different PR.

@@ -25,6 +25,12 @@ function(IDLC_GENERATE)
endif()
set(_idlc_depends CycloneDDS::libidlc)
else()
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND NOT ".so" IN_LIST CMAKE_FIND_LIBRARY_SUFFIXES)
# When cross-compiling, find_library looks for libraries using naming onventions of the target,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# When cross-compiling, find_library looks for libraries using naming onventions of the target,
# When cross-compiling, find_library looks for libraries using naming conventions of the target,

@ErikTempelaarVO
Copy link

In Msys2 the change in src/idl/src/file.h is required for it to build.

#ifdef _MSC_VER
# include <basetsd.h>
typedef SSIZE_T ssize_t;
#endif

Otherwise it fails with this error:

[246/284] Building C object src/idl/CMakeFiles/idl.dir/src/directive.c.obj
FAILED: src/idl/CMakeFiles/idl.dir/src/directive.c.obj
C:\tools\msys64\mingw32\bin\cc.exe -DNTDDI_VERSION=NTDDI_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -D__USE_MINGW_ANSI_STDIO=1 -Didl_EXPORTS -IC:/dev/cyclonedds/src/idl/include -IC:/dev/cyclonedds/src/idl/src -IC:/dev/cyclonedds/build/src/idl/include -IC:/dev/cyclonedds/build/src/idl -IC:/dev/cyclonedds/src/idl/../core/ddsi/include -IC:/dev/cyclonedds/src/idl/../core/cdr/include -IC:/dev/cyclonedds/src/security/api/include -IC:/dev/cyclonedds/build/src/security/api/include -IC:/dev/cyclonedds/src/security/api/../../core/ddsi/include -IC:/dev/cyclonedds/src/security/api/../../core/cdr/include -IC:/dev/cyclonedds/build/src/core -IC:/dev/cyclonedds/build/src/core/include -IC:/dev/cyclonedds/src/core/ddsc/include -IC:/dev/cyclonedds/src/ddsrt/include -IC:/dev/cyclonedds/src/ddsrt/src -IC:/dev/cyclonedds/build/src/ddsrt/include -O2 -g -DNDEBUG -std=gnu99 -Wall -Wextra -Wconversion -Wmissing-prototypes -fdiagnostics-color=always -MD -MT src/idl/CMakeFiles/idl.dir/src/directive.c.obj -MF src\idl\CMakeFiles\idl.dir\src\directive.c.obj.d -o src/idl/CMakeFiles/idl.dir/src/directive.c.obj -c C:/dev/cyclonedds/src/idl/src/directive.c
In file included from C:/dev/cyclonedds/src/idl/src/directive.c:23:
C:/dev/cyclonedds/src/idl/src/file.h:23:17: error: conflicting types for 'ssize_t'; have 'SSIZE_T' {aka 'long int'}
   23 | typedef SSIZE_T ssize_t;
      |                 ^~~~~~~
In file included from C:/tools/msys64/mingw32/include/crtdefs.h:10,
                 from C:/tools/msys64/mingw32/include/assert.h:15,
                 from C:/dev/cyclonedds/src/idl/src/directive.c:11:
C:/tools/msys64/mingw32/include/corecrt.h:47:13: note: previous declaration of 'ssize_t' with type 'ssize_t' {aka 'int'}
   47 | typedef int ssize_t;
      |             ^~~~~~~
[248/284] Building C object src/idl/CMakeFiles/idl.dir/src/tree.c.obj
FAILED: src/idl/CMakeFiles/idl.dir/src/tree.c.obj
C:\tools\msys64\mingw32\bin\cc.exe -DNTDDI_VERSION=NTDDI_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -D__USE_MINGW_ANSI_STDIO=1 -Didl_EXPORTS -IC:/dev/cyclonedds/src/idl/include -IC:/dev/cyclonedds/src/idl/src -IC:/dev/cyclonedds/build/src/idl/include -IC:/dev/cyclonedds/build/src/idl -IC:/dev/cyclonedds/src/idl/../core/ddsi/include -IC:/dev/cyclonedds/src/idl/../core/cdr/include -IC:/dev/cyclonedds/src/security/api/include -IC:/dev/cyclonedds/build/src/security/api/include -IC:/dev/cyclonedds/src/security/api/../../core/ddsi/include -IC:/dev/cyclonedds/src/security/api/../../core/cdr/include -IC:/dev/cyclonedds/build/src/core -IC:/dev/cyclonedds/build/src/core/include -IC:/dev/cyclonedds/src/core/ddsc/include -IC:/dev/cyclonedds/src/ddsrt/include -IC:/dev/cyclonedds/src/ddsrt/src -IC:/dev/cyclonedds/build/src/ddsrt/include -O2 -g -DNDEBUG -std=gnu99 -Wall -Wextra -Wconversion -Wmissing-prototypes -fdiagnostics-color=always -MD -MT src/idl/CMakeFiles/idl.dir/src/tree.c.obj -MF src\idl\CMakeFiles\idl.dir\src\tree.c.obj.d -o src/idl/CMakeFiles/idl.dir/src/tree.c.obj -c C:/dev/cyclonedds/src/idl/src/tree.c
In file included from C:/dev/cyclonedds/src/idl/src/tree.c:21:
C:/dev/cyclonedds/src/idl/src/file.h:23:17: error: conflicting types for 'ssize_t'; have 'SSIZE_T' {aka 'long int'}
   23 | typedef SSIZE_T ssize_t;
      |                 ^~~~~~~
In file included from C:/tools/msys64/mingw32/include/crtdefs.h:10,
                 from C:/tools/msys64/mingw32/include/assert.h:15,
                 from C:/dev/cyclonedds/src/idl/src/tree.c:11:
C:/tools/msys64/mingw32/include/corecrt.h:47:13: note: previous declaration of 'ssize_t' with type 'ssize_t' {aka 'int'}
   47 | typedef int ssize_t;
      |             ^~~~~~~
[259/284] Building C object src/idl/CMakeFiles/idl.dir/src/file.c.obj
FAILED: src/idl/CMakeFiles/idl.dir/src/file.c.obj
C:\tools\msys64\mingw32\bin\cc.exe -DNTDDI_VERSION=NTDDI_WIN7 -D_WIN32_WINNT=_WIN32_WINNT_WIN7 -D__USE_MINGW_ANSI_STDIO=1 -Didl_EXPORTS -IC:/dev/cyclonedds/src/idl/include -IC:/dev/cyclonedds/src/idl/src -IC:/dev/cyclonedds/build/src/idl/include -IC:/dev/cyclonedds/build/src/idl -IC:/dev/cyclonedds/src/idl/../core/ddsi/include -IC:/dev/cyclonedds/src/idl/../core/cdr/include -IC:/dev/cyclonedds/src/security/api/include -IC:/dev/cyclonedds/build/src/security/api/include -IC:/dev/cyclonedds/src/security/api/../../core/ddsi/include -IC:/dev/cyclonedds/src/security/api/../../core/cdr/include -IC:/dev/cyclonedds/build/src/core -IC:/dev/cyclonedds/build/src/core/include -IC:/dev/cyclonedds/src/core/ddsc/include -IC:/dev/cyclonedds/src/ddsrt/include -IC:/dev/cyclonedds/src/ddsrt/src -IC:/dev/cyclonedds/build/src/ddsrt/include -O2 -g -DNDEBUG -std=gnu99 -Wall -Wextra -Wconversion -Wmissing-prototypes -fdiagnostics-color=always -MD -MT src/idl/CMakeFiles/idl.dir/src/file.c.obj -MF src\idl\CMakeFiles\idl.dir\src\file.c.obj.d -o src/idl/CMakeFiles/idl.dir/src/file.c.obj -c C:/dev/cyclonedds/src/idl/src/file.c
In file included from C:/dev/cyclonedds/src/idl/src/file.c:26:
C:/dev/cyclonedds/src/idl/src/file.h:23:17: error: conflicting types for 'ssize_t'; have 'SSIZE_T' {aka 'long int'}
   23 | typedef SSIZE_T ssize_t;
      |                 ^~~~~~~
In file included from C:/tools/msys64/mingw32/include/crtdefs.h:10,
                 from C:/tools/msys64/mingw32/include/assert.h:15,
                 from C:/dev/cyclonedds/src/idl/src/file.c:11:
C:/tools/msys64/mingw32/include/corecrt.h:47:13: note: previous declaration of 'ssize_t' with type 'ssize_t' {aka 'int'}
   47 | typedef int ssize_t;
      |             ^~~~~~~
[263/284] Linking C executable bin\symbol_export_test.exe
ninja: build stopped: subcommand failed.

This isn't an issue in the Docker-build, because idlc is compiled natively, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question on building for mingw64 32-bit with conflicting definition of SSIZE_T
2 participants