hsthrift
hsthrift copied to clipboard
Run hsthrift CI with LD_BIND_NOW=1 environment variable
The GHC version obtained via ghcup seems to be build without the _GNU_SOURCE compiler macro. This causes it to default to lazy symbol loading .
This in turn hides compilation errors because missing symbols will only show up when they are actually called. hsthrift compilation fails under nixos because it is compiling GHC with _GNU_SOURCE and in turn does not default to lazy loading of symbols, this causes "undefined symbol" errors during compilation.
To reproduce this run:
export LD_BIND_NOW=1
cabal test fb-util:string-quasi
This will correctly fail with the following error:
Configuring test suite 'string-quasi' for fb-util-0.1.0.0..
Preprocessing test suite 'string-quasi' for fb-util-0.1.0.0..
Building test suite 'string-quasi' for fb-util-0.1.0.0..
[1 of 2] Compiling SpecRunner ( tests/github/SpecRunner.hs, /root/git/hsthrift/dist-newstyle/build/x86_64-linux/ghc-8.4.4/fb-util-0.1.0.0/t/string-quasi/build/string-quasi/string-quasi-tmp/SpecRunner.o )
[2 of 2] Compiling StringQuasiTest ( tests/StringQuasiTest.hs, /root/git/hsthrift/dist-newstyle/build/x86_64-linux/ghc-8.4.4/fb-util-0.1.0.0/t/string-quasi/build/string-quasi/string-quasi-tmp/StringQuasiTest.o )
<command line>: can't load .so/.DLL for: /root/git/hsthrift/dist-newstyle/build/x86_64-linux/ghc-8.4.4/fb-util-0.1.0.0/build/libHSfb-util-0.1.0.0-inplace-ghc8.4.4.so (/root/git/hsthrift/dist-newstyle/build/x86_64-linux/ghc-8.4.4/fb-util-0.1.0.0/build/libHSfb-util-0.1.0.0-inplace-ghc8.4.4.so: undefined symbol: alignedAlloc)
PR https://github.com/facebookincubator/hsthrift/pull/89 Already addresses this particular compilation issue but I think it would be prudent to disable lazy loading in the CI to catch these errors in the future.