zig icon indicating copy to clipboard operation
zig copied to clipboard

[openbsd] Fetching versioned library

Open rwsalie opened this issue 1 year ago • 10 comments

Hi zig developers, as i mention yesterday, Zig can't be able to fetch as well shared library on OpenBSD, because no symlink are available. I made up a little patch for OpenBSD making Zig compilator link shared versioned library as well.

#18465

Sorry for disturbing you again, i'm just a novice on Zig who want to help/contribute, not to harass you what openbsd or by our idiomatic.

rwsalie avatar Jan 07 '24 22:01 rwsalie

Could you remove the else block? Makes it clearer that this is a special case for the openBSD dynamic libs.

Vexu avatar Jan 07 '24 23:01 Vexu

Is it more clear like this @Vexu ? or should i move somehting ?

Edit : Seems caught an error with src/Compilation.zig at 2062, i'll try to check it out too...

rwsalie avatar Jan 08 '24 01:01 rwsalie

Compiling works well, i forgot to put path in test_path too.. sorry !

rwsalie avatar Jan 08 '24 02:01 rwsalie

Update Done !

rwsalie avatar Jan 17 '24 19:01 rwsalie

Or, provide evidence that it is supposed to work this way in another compiler's codebase, or OpenBSD documentation.

oh my god, they actually patched LLD to do this logic https://github.com/openbsd/ports/blob/master/devel/llvm/17/patches/patch-lld_ELF_DriverUtils_cpp

andrewrk avatar Jan 20 '24 06:01 andrewrk

To make coherent with the patch of LLD, i put find_maj_min_sh_lib to run after main_check. Sorry if the use of fatal function is incorrect on catch block of fs.cwd().openDir or with std.fmt.parseInt.

rwsalie avatar Jan 20 '24 13:01 rwsalie

Thanks for working on this.

I have a feeling this is going to require a few back and forths, so if you get tired of working on it, just let me know and I can finish it for you.

You're welcome ! i should be the first one which should thank you, for helping us to use Zig on OpenBSD ! :smile:

(i forgot to answer you, sorry of the late), i had no problem to help at all, but if you see i'm struggling a lot (as error handling because idk how to manage, or which message i should print) you can help or even commit on my branch !

rwsalie avatar Jan 20 '24 19:01 rwsalie

@andrewrk does this changes seems good ?

rwsalie avatar Jan 24 '24 23:01 rwsalie

(OpenBSD dev here), from OpenBSD point of vue, it LGTM.

semarie avatar Feb 03 '24 10:02 semarie

(OpenBSD dev here), from OpenBSD point of vue, it LGTM.

Thank you for your approval! sorry for the latest commit (i forgot to remove the stupid switch(link_mode) case i putted here)

rwsalie avatar Feb 03 '24 11:02 rwsalie