Closed realconebob closed 1 month ago
Hi,
The GNU make manual says that -l
parameters should go into LDLIBS
but the -L
parameters should go to LDFLAGS
.
pkg-config
has the --libs-only-l
and --libs-only-L
options to solve this.
So maybe this should be:
LDFLAGS += $$(pkg-config --libs-only-L libsodium)
LDLIBS += $$(pkg-config --libs-only-l libsodium)
instead.
Still, if we want to use only one, LDFLAGS
looks way more common that LDLIBS
.
Grepping the entire OpenBSD base source code:
$ ug LDLIBS | wc -l
16
$ ug LDFLAGS | wc -l
2556
It's a bit unexpected that your make
command gets LDLIBS
but not LDFLAGS
. I couldn't reproduce this on any system with gmake
, and with BSD make, LDLIBS
must be handled explicitly.
What make
version do you use?
What
make
version do you use?
GNU make 4.3:
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
I wonder if it's a GNU make specific thing
Hi,
The GNU make manual says that
-l
parameters should go intoLDLIBS
but the-L
parameters should go toLDFLAGS
.
pkg-config
has the--libs-only-l
and--libs-only-L
options to solve this.So maybe this should be:
LDFLAGS += $$(pkg-config --libs-only-L libsodium) LDLIBS += $$(pkg-config --libs-only-l libsodium)
instead.
I dropped this into my project and it worked fine, although I have no idea if it would be more or less stable for others
Setting
LDFLAGS
to$(pkg-config --libs libsodium)
in a makefile results in a linker error, whereas settingLDLIBS
to the same value works fineExample makefiles:
Note: This is my first contribution to a reasonably large public project. Any constructive criticism is appreciated