sbmlteam / libSBML-dependencies

Set of dependencies for compiling libSBML
Other
3 stars 1 forks source link

Build with mingw-w64 #1

Closed thehoglet closed 6 years ago

thehoglet commented 6 years ago

My set-up is this:

Windows 10 Enterprise 64-bit mingw-w64: x86_64-7.2.0-posix-seh-rt_v5-rev1 CMAKE v3.10.0-rc5

I generate using MinGW Makefiles and default settings. Running mingw32-make, I get this compiler error:

C:\public\libSBML-dependencies-master\check\src\check.h:408:16: error: conflicting types for 'pid_t'
  typedef void* pid_t;
                ^~~~~
In file included from C:\public\libSBML-dependencies-master\check\src\check.h:84:0,
                 from C:\public\libSBML-dependencies-master\check\src\check.c:28:
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/sys/types.h:68:16: note: previous declaration of 'pid_t' was here
 typedef _pid_t pid_t;
                ^~~~~
mingw32-make[2]: *** [check\CMakeFiles\libcheck.dir\build.make:63: check/CMakeFiles/libcheck.dir/src/check.c.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:140: check/CMakeFiles/libcheck.dir/all] Error 2
mingw32-make: *** [Makefile:151: all] Error 2

I was curious so I commented out the offending typedef and tried again:

C:\public\libSBML-dependencies-master\check\src\check_log.c:52:5: error: redefinition of 'snprintf'
 int snprintf( char *str, size_t size, const char *format, ... )
     ^~~~~~~~
In file included from C:\public\libSBML-dependencies-master\check\src\check_log.c:24:0:
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/stdio.h:569:5: note: previous definition of 'snprintf' was here
 int snprintf (char * __restrict__ __stream, size_t __n, const char * __restrict__ __format, ...)
     ^~~~~~~~
C:\public\libSBML-dependencies-master\check\src\check_log.c:67:10: fatal error:  time.h : No such file or directory
 #include < time.h >
          ^~~~~~~~~~
compilation terminated.
mingw32-make[2]: *** [check\CMakeFiles\libcheck.dir\build.make:138: check/CMakeFiles/libcheck.dir/src/check_log.c.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:140: check/CMakeFiles/libcheck.dir/all] Error 2
mingw32-make: *** [Makefile:151: all] Error 2

I also tried a -U WIN32 compiler switch. It didn't help.

Any idea what I'm doing wrong?

skeating commented 6 years ago

Hi

Generally we use this project for building dependencies for the different MS Visual Studio versions and do not often use MINGW.

It looks like your build did not like the libcheck code. This is not a necessary dependency for libsbml.

We do know that a build with expat and mingw did work; you could perhaps try that - leaving out the check library.

The team member with most MINGW experience is currently on vacation but will follow up with you if the above does not work. Let us know.

Thanks

Sarah

thehoglet commented 6 years ago

Thanks for your suggestion. I tried leaving out the check library. The compilation proceeded much further this time but still failed:

C:\public\libSBML-dependencies-master\xerces-c\src\xercesc\util\MsgLoaders\Win32\Win32MsgLoader.cpp:176:44: error: invalid conversion from 'XMLCh* {aka short unsigned int*}' to 'wchar_t*' [-fpermissive]
     wcsncpy(toFill, pBlock + 1, actualChars);
                                            ^
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/guiddef.h:148:0,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/winnt.h:628,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/minwindef.h:163,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windows.h:69,
                 from C:\public\libSBML-dependencies-master\xerces-c\src\xercesc\util\MsgLoaders\Win32\Win32MsgLoader.cpp:26:
C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/string.h:141:12: note:   initializing argument 1 of 'wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t)'
   wchar_t *wcsncpy(wchar_t * __restrict__ _Dest,const wchar_t * __restrict__ _Source,size_t _Count) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
            ^~~~~~~
C:\public\libSBML-dependencies-master\xerces-c\src\xercesc\util\MsgLoaders\Win32\Win32MsgLoader.cpp:176:28: error: invalid conversion from 'const XMLCh* {aka const short unsigned int*}' to 'const wchar_t*' [-fpermissive]
     wcsncpy(toFill, pBlock + 1, actualChars);
                     ~~~~~~~^~~
In file included from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/guiddef.h:148:0,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/winnt.h:628,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/minwindef.h:163,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windef.h:8,
                 from C:/PROGRA~1/MINGW-~1/X86_64~1.0-P/mingw64/x86_64-w64-mingw32/include/windows.h:69,
                 from C:\public\libSBML-dependencies-master\xerces-c\src\xercesc\util\MsgLoaders\Win32\Win32MsgLoader.cpp:26:

Unsurprisingly, the XML parser lib is not optional. Any ideas?

Thanks for your help with this.

fbergmann commented 6 years ago

It might surprise you, but even that xml parser is optional :) ... the dependencies package contains all three supported XML parsers. I would recommend, just compiling the expat one ... install to a desired location, and then configure libSBML with:

cmake -DWITH_LIBXML=OFF -DWITH_EXPAT=ON -DLIBSBML_DEPENDENCY_DIR=<install location> <other options> <libsbml source dir>

like sarah mentioned, the primary use for this repository is to make it easier building all dependencies for visual studio. For mingw it is probably easier just to compile the sources for the configuration you want by hunting down the source tarballs and compiling them using the gnumake build scripts contained therein.

fbergmann commented 6 years ago

Just as an aside, could you let us know, why you have the dependency on mingw?

thehoglet commented 6 years ago

libSBML is a dependency of GNU MCSim. MCSim requires its users to have a C++ compiler installed. On Windows an option is the Microsoft MSVC Build Tools, but it weighs in at over 2GB, which is excessive just to recompile a tiny command line tool. mingw (64-bit) at 400MB is a lightweight alternative.

Strictly speaking, I don't need to build libSBML with mingw. It never occurred to me scavenge the libSBML dependencies from their original sources.

Thanks for your help with this. I'll have a go building with expat later today.