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

[BUILD] Use make's linker flags for libraries #370

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Conversation

itislu
Copy link
Sponsor Collaborator

@itislu itislu commented Jul 30, 2024

image

I also finally understand why the order of the linker flags matters!
First the flags, then the source files which need the libraries, then the libraries.
This is because the linker looks for the symbols missing in a given file only in the files coming after it.

The location of where to look for the libraries (-L / LDFLAGS) is a flag for the linker, so it should be in front.
And the actual libraries to include (-l / LDLIBS) need to be after the object files.
That's why it makes sense that LDFLAGS and LDLIBS are separate variables.

@itislu itislu added the devops Development related label Jul 30, 2024
@itislu itislu force-pushed the build-linker-flags branch 4 times, most recently from 3b4bba7 to f6b9ff3 Compare August 4, 2024 21:21
@LeaYeh LeaYeh merged commit 52f490b into main Aug 25, 2024
39 checks passed
@itislu itislu deleted the build-linker-flags branch August 25, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Development related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants