Bazel doesn't compile on Debian Wheezy

909 views
Skip to first unread message

Brian Silverman

unread,
Jul 19, 2015, 6:22:02 PM7/19/15
to bazel-...@googlegroups.com
The recent change to opt flags (ee8fcd3 Add a couple of flags to the CROSSTOOL file, especially for -c opt.) seems to have broken builds with the default toolchain in Debian Wheezy (GCC 4.7.2-1 and binutils 2.22-8+deb7u2). Using both -fPIE and -fPIC for compile commands doesn't do what Bazel expects with this toolchain.

The first error I hit when building bazel is this one:
/usr/bin/ld: bazel-out/local_linux-fastbuild/bin/src/main/native/_objs/libunix.so/src/main/native/unix_jni.pic.o: relocation R_X86_64_PC32 against symbol `_Z13PostExceptionP7JNIEnv_iRKSs' can not be used when making a shared object; recompile with -fPIC

If I hack around that first error, more similar errors show up. Commenting out the -fPIE and -fpie lines in //tools/cpp/CROSSTOOL fixes the compile for me.

I'm not sure if there is a way to only use -fPIE when -fPIC isn't manually specified with the current CROSSTOOL infrastructure or not.

Han-Wen Nienhuys

unread,
Jul 21, 2015, 7:25:44 AM7/21/15
to Brian Silverman, bazel-...@googlegroups.com, Ulf Adams
> --
> You received this message because you are subscribed to the Google Groups
> "bazel-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bazel-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bazel-discuss/CAP01z6KXR6hUagr8aB8V%3DFh5AYoR%2BfvNmd1KCMcV6HCzcmC-9g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Han-Wen Nienhuys
Google Munich
han...@google.com

cfl...@gmail.com

unread,
Aug 4, 2015, 1:37:16 AM8/4/15
to bazel-discuss
+1, I am having the same issue. This is difficult because Google Managed VMs rely on Wheezy for their base images. I am now stuck unable to use Bazel for Managed VM deployment :(

cfl...@gmail.com

unread,
Aug 4, 2015, 1:38:48 AM8/4/15
to bazel-discuss, cfl...@gmail.com
FWIW, here's the output I get from the Wheezy Docker image:

INFO 2015-08-04 05:34:46,408 containers.py:282] /usr/bin/ld: bazel-out/local_linux-fastbuild/bin/src/main/native/_objs/libunix.so/src/main/native/unix_jni.pic.o: relocation R_X86_64_PC32 against symbol `_Z13PostExceptionP7JNIEnv_iRKSs' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

INFO 2015-08-04 05:34:46,408 containers.py:282] ERROR: /home/vmagent/appengine-java-vmruntime/webapps/root/bazel/src/main/native/BUILD:26:1: Linking of rule '//src/main/native:libunix.so' failed: gcc failed: error executing command /usr/bin/gcc -shared -o bazel-out/local_linux-fastbuild/bin/src/main/native/libunix.so -Wl,-whole-archive ... (remaining 14 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.

Yogur

unread,
Sep 11, 2015, 8:28:15 PM9/11/15
to bazel-discuss, cfl...@gmail.com
deleting -fPIE from tools/cpp/CROSSTOOL
Reply all
Reply to author
Forward
0 new messages