-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Description
When specifying additional libraries to be linked with pkg.lflags, the order of the libraries is not preserved. Instead, flags seem to be sorted in alphabetical order.
This is a problem when symbols in one of the libraries are defined in another, e.g. the following fails to link:
nm liba.a
00000001 T foo
nm libb.a
00000001 U foo
cat pkg.yml:
pkg.lflags:
- "-lb"
- "-la"
Normally, foo from libb will be added to the undefined list, and then matched to foo in liba once it is encountered. However newt actually executes gcc ... -la -lb, which strips the unused foo from liba before processing libb and results in an undefined reference to foo.
A workaround is to rename or symlink the libraries into the order you wish them to be linked 🤮
Metadata
Metadata
Assignees
Labels
No labels