bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66699: zig: fail to link SDL2


From: Ekaitz Zarraga
Subject: bug#66699: zig: fail to link SDL2
Date: Fri, 10 Nov 2023 09:57:43 +0000

Hi,


On Friday, November 10th, 2023 at 06:01, Nguyễn Gia Phong <cnx@loang.net> wrote:

> On 2023-11-01 at 20:52+00:00, Ekaitz Zarraga wrote:
> 
> > On Monday, October 23rd, 2023 at 09:34, Nguyễn Gia Phong wrote:
> > 
> > > I am trying to package Mepo, an OpenStreetMap frontend written in Zig.
> > > The currently packaged Zig fails to find transitive dependencies of SDL2:
> > > https://paste.sr.ht/~cnx/db21e1ef9a6828f3ec898db43b790d71b5ef213a
> > 
> > The problem is not Zig specific, look: [...]
> > 
> > guix shell sdl2 sdl2-image gcc-toolchain glibc:static
> > 
> > And tried to build: [...] The list of errors are basically the same
> > you have. Zig builds statically if I'm not mistaken
> > so it's triggering the same problem GCC would for that case.
> > 
> > We need to research this further...
> > 
> > I don't have the Zig knowledge to know how does all this work,
> > but I know it's not just the build-system's fault
> > because it happens in GCC too, and also with a normal shell
> > with `zig` available, and running the command by hand.
> > The build-system just replicates that behavior.
> 
> 
> Thanks, this clears it up for me. So far Zig does not offer a way
> to prefer dynamic or static and just search alphabetically:
> https://github.com/ziglang/zig/issues/14111

Maybe there are more flags for this, but I'm not sure.
 
> On 2023-05-23 at 17:11Z, Michael Dusan wrote:
> 
> > A workaround is if you are only using the zig cc driver,
> > the syntax -l:<FULLNAME> will find the first fully-named library file
> > that matches against search dirs. For example:
> > 
> > * -lz will search dirs, prefer lib<BASENAME>.a over lib<BASENAME>.so
> > * -l:libz.so will search directly for libz.so
> > and not care about any other name permutations
> 
> 
> I do wonder though, if it's a generally good idea have separate
> shared and static outputs for e.g. SDL2. Obviously Zig programs
> would benefit from this, and specifying linkage preference
> under GCC is via the same -l:lib*.* flag.

I'm not very versed on this so I can't give you a proper answer.

> On 2023-11-01 at 20:52+00:00, Ekaitz Zarraga wrote:
> 
> > I also checked Mepo, how do they manage to build directly?
> 
> Sorry, could you rephrase this question?
> I don't get what you meant by directly here.

Yes, it was pretty badly phrased.
The question here was about how do the Mepo devs build mepo in other
linux distributions... They should have a similar problem to what we
have. Or other systems like Nix, how do they build?
In Nix the problem should appear too.

With *directly* I meant the Mepo repository doesn't contain the
transitive dependencies so... It would never work for us, but it
should be working for them.

Reading your message before seems like they manage to link against
the SDL .so so nothing of this happens...

I'll try to check all this with the Zig people to see if we can
fix.

Thanks!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]