Skip to content

Instantly share code, notes, and snippets.

@keichi
Last active October 14, 2022 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keichi/809f2c3c08694e44a5a7224da94f606d to your computer and use it in GitHub Desktop.
Save keichi/809f2c3c08694e44a5a7224da94f606d to your computer and use it in GitHub Desktop.
nld RPATH issue
ncc -fPIC -shared -o libbar.so bar.c
ncc -fPIC -shared -o libfoo.so foo.c -Wl,-rpath,$(pwd) -L. -lbar
ncc main.c -Wl,-rpath,$(pwd) -L. -lfoo
#include <stdio.h>
void bar()
{
printf(__func__);
}
extern void bar();
void foo()
{
bar();
}
extern void foo();
int main()
{
foo();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment