Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md: Getting started #198

Merged
merged 1 commit into from
Apr 26, 2022
Merged

Conversation

RobbertH
Copy link
Contributor

Moving the gcc linker option -ldl later.
With gcc -ldl demo.c -o demo, I got:

/usr/bin/ld: /tmp/ccg6cKgo.o: in function `main':
demo.c:(.text+0x30): undefined reference to `dlopen'
/usr/bin/ld: demo.c:(.text+0x40): undefined reference to `dlerror'
/usr/bin/ld: demo.c:(.text+0x6d): undefined reference to `dlerror'
/usr/bin/ld: demo.c:(.text+0x80): undefined reference to `dlsym'
/usr/bin/ld: demo.c:(.text+0x89): undefined reference to `dlerror'
/usr/bin/ld: demo.c:(.text+0x11d): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status

While gcc demo.c -ldl -o demo compiles.
Here's a stackoverflow answer that explains why this is happening:
https://stackoverflow.com/questions/11893996/why-does-the-order-of-l-option-in-gcc-matter/11894098#11894098

Signed-off-by: Robbert Hofman <hofman.robbert@gmail.com>
@cgaebel
Copy link
Contributor

cgaebel commented Apr 26, 2022

Thank you!

@cgaebel cgaebel merged commit a568376 into janestreet:master Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants