What steps will reproduce the problem?
Build a shared_library target using gcc or clang without cflags on x86-64.
Example gyp file:
{
'targets': [
{
'target_name': 'libsomething',
'type': 'shared_library',
'sources': [
'src/filename.cc',
'src/filename.h',
],
},
],
}
Environment:
CC=clang
CXX=clang++
GYP_GENERATORS=ninja
Gyp command:
$ /usr/bin/gyp --depth .
What is the expected output? What do you see instead?
Expected successful linking of the shared library.
Observed:
FAILED: flock linker.lock clang++ -shared -o lib/libsomething.so
-Wl,-soname=libsomething.so -Wl,--whole-archive obj/src/libsomething.filename.o
-Wl,--no-whole-archive
/usr/bin/ld: obj/src/libsomething.filename.o: relocation R_X86_64_32S against
`_ZTVN4i18n12yournamespace10YourClassNamerE' can not be used when making a
shared object; recompile with -fPIC
obj/src/libsomething.filename.o: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
What version of the product are you using? On what operating system?
GYP version 0.1~svn1395-1 on Ubuntu 12.04.3 LTS.
Please provide any additional information below.
This is on x86-64 arch. The work-around is to add "-fPIC" clang file manually.
Original issue reported on code.google.com by rous...@chromium.org on 16 Oct 2013 at 6:33
Original issue reported on code.google.com by
rous...@chromium.org
on 16 Oct 2013 at 6:33