Click here to Skip to main content
15,886,724 members

How do I link to a non-default glibc library?

coffeenet asked:

Open original thread
Hi,
I have successfully cross-compiled a program on an x86-64 machine. However, when I try to run on my target machine sh4a, I get the following error:
./ioq3ded.sh4a: /lib/libc.so.6: version `GLIBC_2.11' not found (required by ./ioq3ded.sh4a)

The details of the two machines are as follows:
Compiling machine
architecture: x86-64
LIBC version: 2.11

Executing mechine
architecture: sh4a
LIBC version: 2.5

Programming Language is C

Therefore, as a solution, I tried to compile a 2.11 LIBC library on the sh4a machine. However, it failed because the GCC compiler on the sh4a machine was too old, I don't have the authority, nor is there a possibility for upgrading the GCC.
Furthermore, as an alternative solution, I tried to compile a 2.5 LIBC library on the x86-64 so I can link to them during cross-compilation time. However, the ./configure failed because there were missing required objects.
Moreover, I tried to -static compile the program. However, it failed:
As for ioquake3, I tried to statically build it:
/bin/ld: /r/home7/usr/lib/libc.a(dl-tsd.o): TLS local exec code cannot be linked into shared objects
It seems impossible to statically build it with the old version of gcc we have.
I looked up this problem:
https://bugs.gentoo.org/show_bug.cgi?id=122665

Moreover, I downloaded the LIBC 2.5 for x86-64 from the net:
http://rpm.pbone.net/index.php3/stat/4/idpl/12884473/dir/startcom_5/com/glibc-2.5-34.x86_64.rpm.html[^]

However, I cannot seem to find the right flags for compiling so that it links against MY specific (2.5 version library) rather than the system ones (2.11 version library).

Here comes my question:
* What should be the "make" flags be? considering that the folder where MY (2.5 version library) is:
./glibc-2_5/lib64/libc.so
And, my make is as follows:
make USE_LOCAL_HEADERS=0 ARCH=sh4a CFLAGS='-fopenmp -Wall -D_GNU_SOURCE=1 -D_REENTRANT' USE_VOIP=0 BUILD_CLIENT=0 BUILD_MISSIONPACK=0
Tags: Linux, GCC, Cross platform, Compilation

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900