
#11137: configure is broken for the unix package -------------------------------------+------------------------------------- Reporter: pgj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.11 libraries/unix | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Building GHC Unknown/Multiple | failed Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- A few weeks ago (around November 1, 2015), the FreeBSD builders started to fail building GHC-HEAD with an error message something like that: {{{ [...] /usr/home/ghc-builder/work/builder/tempbuild/build/libraries/unix/dist- install/build/libHSunix-2.7.1.0-ghc7.11.20151126.so: undefined reference to `fdatasync' collect2: error: ld returned 1 exit status `gcc48' failed in phase `Linker'. (Exit code: 1) ghc/ghc.mk:121: recipe for target 'ghc/stage2/build/tmp/ghc-stage2' failed gmake[1]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1 Makefile:121: recipe for target 'all' failed gmake: *** [all] Error 2 }}} That is because {{{fdatasync(2)}}} is not implemented on FreeBSD. Apparently, it is handled in the respective file ({{{System/Posix/Unistd.hsc}}}), though it relies on the variable ({{{HAVE_FDATASYNC}}}) generated at the {{{configure}}} phase. But for some reason, the {{{configure}}} script of the {{{unix}}} package fails to detect this as it says the following: {{{ "inplace/bin/ghc-cabal" configure libraries/unix dist-install "" --with- ghc="/usr/home/ghc-builder/work/builder/tempbuild/build/inplace/bin/ghc- stage1" --with-ghc-pkg="/usr/home/ghc- builder/work/builder/tempbuild/build/inplace/bin/ghc-pkg" --disable- library-for-ghci --enable-library-vanilla --enable-library-profiling --enable-shared --with-hscolour="/usr/local/bin/HsColour" --configure- option=CFLAGS="-Wall -fno-stack-protector -Werror=unused-but-set- variable -Wno-error=inline" --configure-option=LDFLAGS=" " --configure- option=CPPFLAGS=" " --gcc-options="-Wall -fno-stack-protector -Werror =unused-but-set-variable -Wno-error=inline " --configure-option=--with- iconv-includes="/usr/local/include" --configure-option=--with-iconv- libraries="/usr/local/lib" --configure-option=--with-gmp- includes="/usr/local/include" --configure-option=--with-gmp- libraries="/usr/local/lib" --with-gcc="/usr/local/bin/gcc48" --with- ld="/usr/local/bin/ld" --configure-option=--with-cc="/usr/local/bin/gcc48" --with-ar="/usr/local/bin/ar" --with-alex="/usr/local/bin/alex" --with- happy="/usr/local/bin/happy" Configuring unix-2.7.1.0... [...] checking for fdatasync... yes }}} That is the corresponding part of the {{{config.log}}}: {{{ configure:4242: checking for fdatasync configure:4263: /usr/local/bin/gcc48 -c -Wall -fno-stack-protector -Werror=unused-but-set-variable -Wno-error=inline conftest.c >&5 conftest.c: In function 'main': conftest.c:71:1: warning: implicit declaration of function 'fdatasync' [-Wimplicit-function-declaration] fdatasync(4); ^ configure:4263: $? = 0 configure:4271: result: yes }}} Looks like GCC is willing to compile the test code, although it notes that it cannot find the declaration of the {{{fdatasync()}}} function. Unfortunately, the {{{configure}}} script does not instruct GCC to do any linking or be serious on such warnings, so it happily proceeds. For the reference, previously the {{{config.log}}} said something like that instead: {{{ configure:4230: checking for fdatasync configure:4230: /usr/local/bin/gcc48 -o conftest -Wall -fno-stack- protector -Werror=unused-but-set-variable -Wno-error=inline conftest.c >&5 /tmp//ccDCjZtO.o: In function `main': conftest.c:(.text+0xa): undefined reference to `fdatasync' collect2: error: ld returned 1 exit status configure:4230: $? = 1 [...] }}} I am inclined to think that this is caused by the commit [https://github.com/haskell/unix/commit/b06446edd4753f964a46d27ddae864fad97ad... b06446edd4753f964a46d27ddae864fad97adc13] for the {{{unix}}} package. Perhaps the following change can fix that, at least it fixed for me: {{{ --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -16,6 +16,7 @@ SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable endif # gcc 4.6 gives 3 warning for giveCapabilityToTask not being inlined SRC_CC_WARNING_OPTS += -Wno-error=inline +SRC_CC_WARNING_OPTS += -Werror=implicit-function-declaration endif else }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11137 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler