0

I have this:

#include "/home/tom/scripts/c/headers/stdio.h"
#include "/home/tom/scripts/c/headers/stdlib.h"
int main()
{
       printf("Hi there\n");
       exit(0);
}

compiling it it with:

gcc hello.c -L/home/tom/scripts/c/ -lc -o hello

and I get:

linux-gate.so.1 (0xb7769000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7571000)
/lib/ld-linux.so.2 (0xb776b000)

I've compiled a bunch a programs in c successfuly but I want the binary to point the shared object ld-linux.so.2 located on /home/tom/scripts/c not to pick the library on the system by default.

testoflow
  • 17
  • 7
  • `and I get:` that looks like `ldd` output, not from `gcc`. Read `man ld.so`. – KamilCuk Mar 23 '21 at 16:23
  • @KamilCuk, You do know the text on the console is not the only output created by gcc, right? The text describes the executable file gotten from gcc. – ikegami Mar 23 '21 at 16:34
  • @KamilCuk, I'm not seeing anything relevant in `man ld.so` on my GNU/Linux (Ubuntu) system. To what were you referring? – ikegami Mar 23 '21 at 16:37
  • I don't know, I'm pretty lost. I want the system (if possible) look for the shared object on that folder instead of `/lib/i386-linux-gnu/` in my case. I have two libraries with the same name. Can two binaries look up for different .so with the same name? that's what I mean. I know can be a silly question, I'm a noob in c. – testoflow Mar 23 '21 at 16:49
  • 2
    Does this answer your question? [How to specify non-default shared-library path in GCC Linux? Getting "error while loading shared libraries" when running](https://stackoverflow.com/questions/8835108/how-to-specify-non-default-shared-library-path-in-gcc-linux-getting-error-whil) – ralf htp Mar 23 '21 at 17:01
  • @ralfhtp thanks, that solves my issues – testoflow Mar 23 '21 at 17:59

0 Answers0