I'm cross compiling a SDK for an embedded board using pre-built mips-linux-uclibc- toolchain. While compiling a set of sources that makes use of libom_api.so library causes an error "undefined reference to `printf@GLIBC_2.0'" and 10 other symbols like getpid@GLIBC2.0. In Makefile they have passed -lom_api along with some other app specific libraries. Is it because libom_api.so is compiled using Glibc compiler? how can I resolve this issue? SDK doesn't have sources of libom_api.so. What I tried: I built a Glibc cross-toolchain with buildroot and passed $(LDGLIBC) to compiler after -lom_api in Makefile (LDGLIBC = -L$(ROOTDIR)/glibc-toolchain/GLIB), still causing error.
Asked
Active
Viewed 500 times
1 Answers
1
is it possible to cross compile (with uclibc toolchain) a program which uses a shared library that causes
'undefined reference to printf@GLIBC_2.0'
No.
Is it because libom_api.so is compiled using Glibc compiler? how can I resolve this issue?
Yes. More precisely, libom_api.so
has been compiled using GLIBC headers and linked against GLIBC implementation of the standard C
library.
Your only choices are:
- obtain a different version of
libom_api.so
, one built against uClibc, or - eliminate dependency on
libom_api
, or - use GLIBC for your entire project

Employed Russian
- 199,314
- 34
- 295
- 362
-
The OP's "using Glibc compiler", also quoted in this answer, is misleading. Glibc is a C standard library, not a compiler. If the OP meant "gcc", then no, the issue is *not* because of gcc use specifically. It is because their `libom_api.so` binary has been built for glibc (not necessarily by gcc), whereas they need one that is built for uclibc (possibly, but not necessarily, by gcc). All that is consistent with this answer, but might not be fully understood from the answer as presently written. – John Bollinger May 28 '22 at 15:09
-
@Employed Russian Ty for answering. sdk has om_api.h file, is there any possibility that I can include headers of glibc library in om_api.h header and it will work? – Prathamesh Konkar May 30 '22 at 06:52
-
@JohnBollinger ty for your reply. Got it, libom_api.so does not necessarily compiled by gcc. What I meant that, Is it because library has been compiled with the toolchain that uses Glibc C library... You have already explained that. – Prathamesh Konkar May 30 '22 at 07:04
-
@PrathameshKonkar "Is there a possiblity ..." - no. The choices I outlined in the answer are the only choices you have. – Employed Russian May 30 '22 at 17:35