Compile error "can not be used when making a PIE object"

Need help with MPD?
Post Reply
J.L.C.
Posts: 27
Joined: January 9th, 2017, 10:12 pm

Compile error "can not be used when making a PIE object"

Post by J.L.C. » October 10th, 2018, 5:51 pm

I am trying to compile the latest main branch, but the build fails with:

/usr/bin/ld: libpcm.a(libpcm_a-SampleFormat.o): relocation R_X86_64_32S against `.rodata._Z23sample_format_to_string12SampleFormat' can not be used when making a PIE object; recompile with -fPIC

git show
commit 1155a2909620f53237f8cf13056eb31496ee78f6 (HEAD -> master, origin/master, origin/HEAD)
Merge: 030e60394 9c1bf9ac5
Author: Max Kellermann <max@musicpd.org>
Date: Mon Oct 8 21:16:52 2018 +0200

This is on Ubuntu 18.04.1

I'm not sure what other system info would be helpful, but I am happy to provide anything I can.

Edit:

Running `make clean`
then `make`

Seems to have worked

max
Forum team
Posts: 801
Joined: January 15th, 2013, 3:43 pm

Re: Compile error "can not be used when making a PIE object"

Post by max » October 11th, 2018, 7:31 am

Maybe you upgraded your toolchain since the previous build, and the new one has different defaults. If anything fails, always rebuild from clean.

Post Reply