Question Details

No question body available.

Tags

c gcc abi

Answers (1)

June 4, 2026 Score: 3 Rep: 151,167 Quality: Medium Completeness: 100%

Based on

(and other sources)

You may run it with

LDLIBRARYPATH=. ./main

but it is complicated. It would need to add . to LDLIBRARYPATH for all system.

More useful is to use -Wl,-rpath,'$ORIGIN' in compilation

gcc -I$(pwd) -o ./main libgeo.so main.c -Wl,-rpath,'$ORIGIN'

By the way:

You can use . instead of $(pwd)

gcc -I. -o ./main libgeo.so main.c -Wl,-rpath,'$ORIGIN'

On Linux Mint I had to use -L. -lgeo instead of libgeo.so

gcc -I. -o ./main main.c -L. -lgeo -Wl,-rpath,'$ORIGIN'

(-lgeo has to be after main.c, other parameters can be before main.c)