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

Linking error on OpenBSD: __builtin_bswap32 not available #1

Closed
maximpichler opened this issue Jun 26, 2016 · 8 comments
Closed

Linking error on OpenBSD: __builtin_bswap32 not available #1

maximpichler opened this issue Jun 26, 2016 · 8 comments
Assignees
Labels

Comments

@maximpichler
Copy link

When linking against cryptohash-sha256-0.11.100.0 (e.g. when building cabal-install) on OpenBSD, the following error occurs:

/home/maxim/.cabal/lib/x86_64-openbsd-ghc-7.10.3/cryptohash-sha256-0.11.100.0-E5uk2F82S4eJ4LnfTKWM8r/libHScryptohash-sha256-0.11.100.0-E5uk2F82S4eJ4LnfTKWM8r.a(sha256.o): In function `hs_cryptohash_sha256_update':
sha256.c:(.text+0x49a): undefined reference to `__builtin_bswap32'

Looks like __builtin_bswap32 doesn't exist on OpenBSD (but l32toh might be an alternative): http://man.openbsd.org/OpenBSD-5.9/man3/be16toh.3

@hvr
Copy link
Collaborator

hvr commented Jun 27, 2016

@maximpichler which compiler/version is used on OpenBSD?

@hvr hvr self-assigned this Jun 27, 2016
@hvr hvr added the bug label Jun 27, 2016
@maximpichler
Copy link
Author

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

@hvr
Copy link
Collaborator

hvr commented Jun 27, 2016

@maximpichler sorry, I meant the c compiler. This is about the __builtin_bswap32 C compiler primitives missing even though the compiler seems to claim to be GCC-compatible...

@maximpichler
Copy link
Author

$ gcc --version
gcc (GCC) 4.2.1 20070719 

http://man.openbsd.org/OpenBSD-5.9/man1/gcc-local.1

@thoughtpolice
Copy link
Collaborator

Yeah, so GCC 4.3 was when __builtin_bswap32 was added (and also when GCC moved to GPLv3), so we're a bit stuck there (I imagine that's part of the reason OpenBSD has not upgraded - aside from the fact they have their own forked modifications). Sigh.

@hvr
Copy link
Collaborator

hvr commented Jun 27, 2016

That's strange... when searching for __builtin_bswap32 you rather find evidence that __builtin_bswap32 was added starting with GCC >= 4.2 rather than >= 4.3:

That being said, we can just tighten the version-check to check for >= 4.3 instead and call it a day :-)

@maximpichler
Copy link
Author

The manuals suggest otherwise: https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Keyword-Index.html mentions __builtin_bswap32, wheras https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Keyword-Index.html doesn't.

@hvr hvr closed this as completed in 50e82a1 Jun 27, 2016
@maximpichler
Copy link
Author

Thanks for the swift fix and release!

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

No branches or pull requests

3 participants