Base 3.16 branch fails to build on MINGW targets
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Medium
|
mdavidsaver |
Bug Description
The build fails in src/std/rec/test when linking asTest.exe:
/usr/bin/
asTestIoc_
asTestIoc_
/usr/bin/
The MinGW linker is stricter than recent versions of Microsoft Visual Studio and requires that symbols marked __declspec(
The fix will involve extracting the two device support layers into their own source file and building that into a library; see src/ioc/db/test for an example that already does this.
I discovered this while cross-compiling Base-3.16 on a Linux box. I don't have a Windows cross-compiler installed on our Jenkins build slave yet or we would have seen this problem earlier — sorry!
Changed in epics-base: | |
status: | Fix Committed → Fix Released |
To be more specific, the failure is with SHARED_LIBRARIES = YES,
STATIC_BUILD = NO. Static builds work correctly (apparently).
A DLL build with i686-w64- mingw32- gcc 4.9.1 (Debian 8 i386) gives me an
earlier failure:
> osiClockTime. obj:osiClockTim e.c:(.text+ 0xaa): undefined reference to `clock_settime' obj:osiClockTim e.c:(.text+ 0x184): undefined reference to `clock_gettime' obj:osiClockTim e.c:(.text+ 0x1d1): undefined reference to `clock_settime' obj:osiClockTim e.c:(.text+ 0x340): undefined reference to `clock_gettime' obj:osiClockTim e.c:(.text+ 0x38c): undefined reference to `clock_settime'
> osiClockTime.
> osiClockTime.
> osiClockTime.
> osiClockTime.
It seems that osiClockTime.c tests for posix-ness with:
> #ifdef CLOCK_REALTIME
While mingw's pthread_time.h header, which is conditionally included by
time.h, does define CLOCK_REALTIME.
> #if !defined( IN_WINPTHREAD) && \ _STRICT_ STDC) && !defined( __XOPEN_ OR_POSIX) ) || \ __EXTENSIONS_ _))
> ((!defined(
> (_POSIX_C_SOURCE > 2) || defined(
> #include <pthread_time.h>
> #endif
This condition looks weird since posix stuff is being included seemingly mingw32- cpp -dM"). So perhaps this is a issue w/ mingw?
by default. It's the only place in the public mingw headers where
_STRICT_STDC is mentioned, and it isn't defined implicitly (according to
"i686-w64-
https:/ /github. com/Alexpux/ mingw-w64/ blob/master/ mingw-w64- headers/ crt/time. h#L286