Closed Blauelf closed 5 years ago
@Blauelf $(LIB_MAJOR)
should be automatically created by ldconfig
when you make install
.
Not sure if I just don't understand makefiles correctly, but does $(LIB_MAJOR)
exist at the time this command is run, and even if I start make
without any compiled files?
Oh, apparently, I am misunderstanding symbolic links. They work fine even if the target does not exist.
Still, there is a target /build/lib/$(LIB_MAJOR)
that is not created in that step, is that the way it is meant?
@Blauelf yes, unless you're doing a make install
, you shouldn't be using $(LIB_MAJOR)
directly.
But ldconfig
does not seem to create that one. After a make install
, I get two files in /usr/local/lib/
:
-rwxr-xr-x 1 root root 21736 Nov 20 23:44 libcs50.so.8.1.2
lrwxrwxrwx 1 root root 12 Nov 20 23:44 libcs50.so -> libcs50.so.8
The link libcs50.so.8 -> libcs50.so.8.1.2
is missing.
Hmm, which Linux distro are you using? Does it work if you do ldconfig /usr/local/lib
?
Tried on arch linux. And yes, that last version with path works, creating the link. Seems like that linux distro does not list /usr/local/lib
in /etc/ld.so.conf.d/*
or $LD_LIBRARY_PATH
, meaning neither linking nor execution works out of the box.
I see. I'm gonna fix shortly. Thank you!
I think it's more an issue with arch Linux discouraging usage of /usr/local
. Not sure why they do. So to use the library when it is installed in /usr/local/lib
, the user always has to adjust something on their system, even if it installed there properly.
Apologies for the delayed response, I just saw this. I also use Arch.
Configuring where libcs50
gets installed is what DESTDIR
is for in the Makefile. If you run sudo DESTDIR=/usr/lib make install
, it will install into /usr/lib
. It may make sense to make /usr/lib
be the default on linux.
Thanks both of you for all that information.
In the Makefile of 8.1.2, there's
If I read it correctly, this builds
$(LIB_VERSION)
, but in the next step creates a link to$(LIB_MAJOR)
(which wasn't built in the step before).