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

Build fails on OSX (the MSG_NOSIGNAL story) #8

Closed
lpeterse opened this issue Jun 25, 2015 · 3 comments
Closed

Build fails on OSX (the MSG_NOSIGNAL story) #8

lpeterse opened this issue Jun 25, 2015 · 3 comments

Comments

@lpeterse
Copy link
Owner

host:dir user$ cabal install socket
Resolving dependencies...
Downloading socket-0.5.1.0...
Configuring socket-0.5.1.0...
Building socket-0.5.1.0...
Failed to install socket-0.5.1.0
Build log ( /Users/user/.cabal/logs/socket-0.5.1.0.log ):
[1 of 1] Compiling Main             ( /var/folders/ff/fr4w8j5n00975_hvxcqby4mw0000gn/T/socket-0.5.1.0-36289/socket-0.5.1.0/dist/setup/setup.hs, /var/folders/ff/fr4w8j5n00975_hvxcqby4mw0000gn/T/socket-0.5.1.0-36289/socket-0.5.1.0/dist/setup/Main.o )
Linking /var/folders/ff/fr4w8j5n00975_hvxcqby4mw0000gn/T/socket-0.5.1.0-36289/socket-0.5.1.0/dist/setup/setup ...
Configuring socket-0.5.1.0...
Building socket-0.5.1.0...
Preprocessing library socket-0.5.1.0...
Message.hsc:59:16: error: use of undeclared identifier 'MSG_NOSIGNAL'
    hsc_const (MSG_NOSIGNAL);
               ^
/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/template-hsc.h:35:10: note: expanded from macro 'hsc_const'
    if ((x) < 0)                                      \
         ^
Message.hsc:59:16: error: use of undeclared identifier 'MSG_NOSIGNAL'
/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/template-hsc.h:36:41: note: expanded from macro 'hsc_const'
        hsc_printf ("%lld", (long long)(x));          \
                                        ^
Message.hsc:59:16: error: use of undeclared identifier 'MSG_NOSIGNAL'
/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/template-hsc.h:38:50: note: expanded from macro 'hsc_const'
        hsc_printf ("%llu", (unsigned long long)(x));
                                                 ^
3 errors generated.
compiling dist/build/System/Socket/Internal/Message_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/System/Socket/Internal/Message_hsc_make.c -o dist/build/System/Socket/Internal/Message_hsc_make.o -m64 -fno-stack-protector -D__GLASGOW_HASKELL__=708 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Iplatform/linux/include -I/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/bytestring-0.10.4.0/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/base-4.7.0.1/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/integer-gmp-0.5.1.0/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/include -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/usr/local/Cellar/ghc/7.8.3/lib/ghc-7.8.3/include/
cabal: Error: some packages failed to install:
socket-0.5.1.0 failed during the building phase. The exception was:
ExitFailure 1

Kudos to Michael Meinel and koex for pointing this out.

@lpeterse
Copy link
Owner Author

@lpeterse lpeterse changed the title Build fails on OSX Build fails on OSX (the MSG_NOSIGNAL story) Jun 26, 2015
@lpeterse
Copy link
Owner Author

MSG_NOSIGNAL is not portable although it's POSIX. WTF?

Another issue:

  • SCTP (lksctp) writes fail with EINVAL when using MSG_NOSIGNAL on Linux.

Here's the plan:

  • Write tests for all this first: Are signals sent at all on the platform?
  • #define MSG_NOSIGNAL 0 on all platforms that don't define it.
  • Disable SIGPIPE via socket option if possible. Use MSG_NOSIGNAL as a fallback (if defined).
  • Reliably let the tests fail on platforms that support neither (e.g. Solaris).

@lpeterse
Copy link
Owner Author

SIGPIPE does not exist at all on Windows: http://tangentsoft.net/wskfaq/articles/bsd-compatibility.html
Good for us.

ItachiSan added a commit to ItachiSan/dolphin that referenced this issue Aug 20, 2018
The issue is caused from a wrong definition in `config.h`, which works
perfectly on every device except for OSX.

Such definition causes `curl_setup_once.h` to use `MSG_NOSIGNAL`, which
is undefined on Apple devices.
More details here:
lpeterse/haskell-socket#8 (comment)

The most cross-platform-friendly way (IMHO obviously) is to say to
Apple devices to ignore such definition, rewriting the preprocessor
check as done in this commit.
dehart referenced this issue in dmitigr/fcgi May 25, 2020
aliaspider pushed a commit to aliaspider/dolphin that referenced this issue Aug 27, 2020
The issue is caused from a wrong definition in `config.h`, which works
perfectly on every device except for OSX.

Such definition causes `curl_setup_once.h` to use `MSG_NOSIGNAL`, which
is undefined on Apple devices.
More details here:
lpeterse/haskell-socket#8 (comment)

The most cross-platform-friendly way (IMHO obviously) is to say to
Apple devices to ignore such definition, rewriting the preprocessor
check as done in this commit.
drizzt pushed a commit to drizzt/dolphin that referenced this issue Feb 11, 2021
The issue is caused from a wrong definition in `config.h`, which works
perfectly on every device except for OSX.

Such definition causes `curl_setup_once.h` to use `MSG_NOSIGNAL`, which
is undefined on Apple devices.
More details here:
lpeterse/haskell-socket#8 (comment)

The most cross-platform-friendly way (IMHO obviously) is to say to
Apple devices to ignore such definition, rewriting the preprocessor
check as done in this commit.

(cherry picked from commit 9e3d696)
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

No branches or pull requests

1 participant