Last active
October 14, 2022 01:28
-
-
Save keichi/809f2c3c08694e44a5a7224da94f606d to your computer and use it in GitHub Desktop.
nld RPATH issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void bar() | |
{ | |
printf(__func__); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern void bar(); | |
void foo() | |
{ | |
bar(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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