I
I
integer_322019-12-08 17:47:06
linux
integer_32, 2019-12-08 17:47:06

How to give a process its own libc?

There is a native library for Android that I'm trying to use via JNI on Linux (ubuntu 18.04). There are no specific dependencies there, except for the android libc (bionic).
And at startup, it tries (obviously, unsuccessfully) to use the system libc, although I try to point it to the path where the libraries should be taken from. He finds other libraries there, but libc stubbornly tries to take the system one.
I do something like this:

$ LD_LIBRARY_PATH=libs java -jar someapp.jar 

/usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header

I don't have library sources, only .so-shka. Is there any way to tell him to use exactly the libc I want?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
lsnstrvsk, 2019-12-09
@lsnstrvsk

and if all this is done in chroot?

V
Vitaly Karasik, 2019-12-09
@vitaly_il1

See https://unix.stackexchange.com/questions/122670/us...

S
Sergey Zabodalov, 2020-01-22
@zabbius

LD_LIBRARY_PATH=libs LD_PRELOAD=your_custom_libc.so java -jar someapp.jar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question