You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 🤮
The text was updated successfully, but these errors were encountered:
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:
Normally,
foo
fromlibb
will be added to the undefined list, and then matched tofoo
inliba
once it is encountered. Howevernewt
actually executesgcc ... -la -lb
, which strips the unusedfoo
fromliba
before processinglibb
and results in an undefined reference tofoo
.A workaround is to rename or symlink the libraries into the order you wish them to be linked 🤮
The text was updated successfully, but these errors were encountered: