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

Bazel: recompile with -fPIC errors on Linux #595

Closed
patrickt opened this issue Jul 8, 2020 · 4 comments
Closed

Bazel: recompile with -fPIC errors on Linux #595

patrickt opened this issue Jul 8, 2020 · 4 comments
Labels
bazel Bazel-specific build concerns build Issues arising when building semantic infrastructure Items relating to packaging, project management, releases, etc.

Comments

@patrickt
Copy link
Contributor

patrickt commented Jul 8, 2020

My experiments here ran into a continual issue:

/usr/bin/ld.gold: error: bazel-out/k8-fastbuild/bin/external/stackage/attoparsec-0.13.2.4/_install/lib/libHSattoparsec-0.13.2.4.a(FastSet.o): requires unsupported dynamic reloc 11; recompile with -fPIC

(repeated thousands of times)

I have no idea what we have to do to fix this, though some googling appears to indicate this is a static/dynamic problem. If you have further insight, please drop a comment here 👀

@patrickt patrickt added bazel Bazel-specific build concerns build Issues arising when building semantic infrastructure Items relating to packaging, project management, releases, etc. labels Jul 8, 2020
@tclem
Copy link
Member

tclem commented Jul 8, 2020

Might be a thing in the base image with ld? We've got this in one of our base dockerfile (used to build semantic stuff internally):

# Buggy versions of ld.bfd fail to link some Haskell packages: https://sourceware.org/bugzilla/show_bug.cgi?id=17689.
# Gold is faster anyways and uses less RAM.
RUN update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20 && \
    update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10

@dcreager
Copy link
Contributor

dcreager commented Jul 8, 2020

I kept running into this on my Linux box when trying to test #579. The best discussion I could find was at tweag/rules_haskell#429. That suggested a few workarounds, none of which worked for me:

$ bazel build -c opt //semantic:exe
$ bazel build --force_pic //semantic:exe
$ bazel build -c opt --copt '-fPIC' //semantic:exe

We might have to enlist Tweag's help with this.

I also got a bunch of "invalid byte sequence" errors, but that one was solvable — I'm on Arch, which uses vanilla glibc, which doesn't provide a C.UTF-8 locale, which rules_haskell wants to use as the reproducible locale when building. Debian/Ubuntu (which I think we're using for our base Docker images) patches glibc to provide that locale, so we shouldn't (and I think you didn't?) run into that error here.

@patrickt patrickt changed the title Bazel: bring up a CI box Bazel: recompile with -fPIC errors on Linux Jul 9, 2020
@aherrmann
Copy link

@patrickt That looks like an error we encountered on Bazel CI recently: tweag/rules_haskell#1349
The issue occurred on Ubuntu 18.04 with GHC 8.8 which seems to match your setup.
A fix is available here: tweag/rules_haskell#1388

@dcreager
Copy link
Contributor

dcreager commented Jul 9, 2020

Woohoo! 🎉 @aherrmann I can confirm that fixes the Linux builds for us: https://github.com/github/semantic/compare/bazel-linux-fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel Bazel-specific build concerns build Issues arising when building semantic infrastructure Items relating to packaging, project management, releases, etc.
Projects
None yet
Development

No branches or pull requests

4 participants