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

symlinks for libs on Linux (e.g.) are not properly done #51

Open
schveiguy opened this issue Sep 21, 2022 · 3 comments
Open

symlinks for libs on Linux (e.g.) are not properly done #51

schveiguy opened this issue Sep 21, 2022 · 3 comments

Comments

@schveiguy
Copy link
Contributor

The symlinks for dynamic libs are not extracted correctly

E.g.:

$ ls -l ~/.dvm/compilers/dmd-2.100.2/linux/lib64/
total 64224
-rw-rw-r-- 1 steves steves 56738472 Sep 10 06:02 libphobos2.a
-rw-rw-r-- 1 steves steves       21 Sep 10 06:02 libphobos2.so
-rw-rw-r-- 1 steves steves       21 Sep 10 06:02 libphobos2.so.0.100
-rw-rw-r-- 1 steves steves  9012616 Sep 10 06:02 libphobos2.so.0.100.2

It should look like this:

-rw-rw-r-- 1 steves steves 56738472 Sep 10 06:02 libphobos2.a
lrwxrwxrwx 1 steves steves       21 Sep 20 23:37 libphobos2.so -> libphobos2.so.0.100.2
lrwxrwxrwx 1 steves steves       21 Sep 20 23:37 libphobos2.so.0.100 -> libphobos2.so.0.100.2
-rw-rw-r-- 1 steves steves  9012616 Sep 10 06:02 libphobos2.so.0.100.2

This results in a failure when you try to use the shared lib version of phobos:

$ dmd -defaultlib=libphobos2.so prog.d
/usr/bin/ld:/home/steves/.dvm/compilers/dmd-2.100.2/linux/bin/../lib64/libphobos2.so: file format not recognized; treating as linker script
/usr/bin/ld:/home/steves/.dvm/compilers/dmd-2.100.2/linux/bin/../lib64/libphobos2.so:0: syntax error
@jacob-carlborg
Copy link
Owner

Hmm, it's probably the Tango ZIP module that doesn't support symlinks. It should be replaced with the one in Phobos.

@schveiguy
Copy link
Contributor Author

It's probably an issue with the API. I don't know what Tango does, but dub has the same exact problem, and it uses std.zip. I'm going to put in a fix for that, as I need it in the case of one project.

The issue with dub is that the zip API doesn't have a "just extract this file the same as it would be if you did unzip on the command line" function, it just gives you the bytes and the file attributes. It's possible to check the attributes to see if it's a symlink, and then call the symlink function, but the current code just writes the bytes to a file, and then applies the attributes (which doesn't magically turn it into a symlink).

@schveiguy
Copy link
Contributor Author

FYI, this is the fix in dub: dlang/dub#2489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants