LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   BUCK compilation required glibc (https://www.linuxquestions.org/questions/programming-9/buck-compilation-required-glibc-4175614859/)

Borneq 10-02-2017 01:57 AM

BUCK compilation required glibc
 
I have build with CMake and is OK, but I must build with Buck.
BUCK is configured to use Clang.
/usr/src/hbase/hbase-native-client/otherlibs/libzmq.a(ipc_listener.cpp.o): In function `zmq::ipc_listener_t::filter(int)':
ipc_listener.cpp:(.text+0xdc0): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
ipc_listener.cpp:(.text+0xda3): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

NevemTeve 10-02-2017 03:43 AM

And what is your question?

Borneq 10-02-2017 05:07 AM

How compile it?

NevemTeve 10-02-2017 05:23 AM

These are just warnings, so they don't prevent you from compiling your program. Nonetheless, statically linking libc is very unusual in Unix/Linux. Why would you do that?

Borneq 10-02-2017 06:31 AM

Sorry, I put no errors but warnings.
Erorr is
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/src/hbase/hbase-native-client/otherlibs/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie
clang: error: linker command failed with exit code 1 (use -v to see invocation)

libc.a is system library, how compile it with -fPIE, where are sources?

pan64 10-02-2017 06:56 AM

you need to recompile your sources with -fPIE and relink with -pie. You do not need to rebuild libc.a, just relink it. But I think you need to give more information about this situation (if this won't help)

Borneq 10-02-2017 10:02 AM

Thanks! linker_flags=['-pie'] helps a lot.
Is only next error:
/usr/bin/ld: /usr/src/hbase/hbase-native-client/otherlibs/libzmq.a(zmq.cpp.o): relocation R_X86_64_32 against `_ZSt7nothrow' can not be used when making a shared object; recompile with -fPIC
/usr/src/hbase/hbase-native-client/otherlibs/libzmq.a: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I must not compile ZMQ with PIC because I want link ZMQ static?
I have
prebuilt_cxx_library(
name="zmq",
lib_dir='../otherlibs'
)

where in otherlibs is 1.8 MB of libzmq.a.
I changed to
prebuilt_cxx_library(
name="zmq",
static_lib='otherlibs/libzmq.a'
)

but still error:
/usr/bin/ld: /usr/src/hbase/hbase-native-client/block-exe/otherlibs/libzmq.a(zmq.cpp.o): relocation R_X86_64_32 against `_ZSt7nothrow' can not be used when making a shared object; recompile with -fPIC
/usr/src/hbase/hbase-native-client/block-exe/otherlibs/libzmq.a: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

NevemTeve 10-02-2017 11:21 PM

You seem to try and compile something that has a built-in libc... It does sound scary. (Also there is C++ in it which makes it scarier.)

Nonetheless, if it asks for relocatable code, then do use -fPIC flag

Borneq 10-03-2017 11:12 AM

Is because I compiled with -pie


All times are GMT -5. The time now is 04:14 AM.