Skip to contentSkip to conversation

Statically Compiling including SDL

Qemu-devel Sam McKelvie 2 participants 4 messages May 11, 2016

lore
Share & tools
lore
#0 lore raw

I am having this same problem. Looking at the configure script it looks like it prefers to use:

pkg-config sdl —static

to get the static linker flags, rather than:

sdl-config —static-libs

The former returns an empty string; the latter returns the correct library list. If it had used the latter it would work properly. There is a note in the configure effect suggesting that pig-config is preferred, but I’m not sure why that is…

#1 lore raw
Quoted 8 lines · Sam McKelvie

I am having this same problem. Looking at the configure script it looks like it prefers to use:

pkg-config sdl —static

to get the static linker flags, rather than:

sdl-config —static-libs

Are you trying to statically compile to get a linux-user binary, or a system-emulation binary? For the former we shouldn't be linking in SDL anyway, and statically compiling the latter isn't really supported in my view. (Maybe we should make configure explicitly reject it. It has a tendency to break because distros don't check the static-compilation version of their pkg-config configuration files.)

Quoted 4 lines

The former returns an empty string; the latter returns the correct library list. If it had used the latter it would work properly. There is a note in the configure effect suggesting that pig-config is preferred, but I’m not sure why that is…

pkg-config plays better with cross compilation: you have one your-architecture-pkg-config which knows about the config files for that architecture for all libraries. Having a different config script for each library makes it a huge pain to try to swap in the right one for each architecture.

(If the two give different answers this is a distro bug.)

thanks
-- PMM

#2 lore raw

Apologies for breaking the thread of the discussion; still haven’t figured out how to cold-respond to a thread without an incoming email.

Thank you for your response. Indeed, for my purposes I only need the static linux-user binary, so I can just remove SDL and it’s not a problem.

I’d agree that it is an SDL package distribution problem; in this case it is coming from delian-jessie.

Thank you,
Sam McKelvie

Quoted 35 lines · Peter Maydell
Quoted 8 lines · Sam McKelvie

I am having this same problem. Looking at the configure script it looks like it prefers to use:

pkg-config sdl —static

to get the static linker flags, rather than:

sdl-config —static-libs

Are you trying to statically compile to get a linux-user binary, or a system-emulation binary? For the former we shouldn't be linking in SDL anyway, and statically compiling the latter isn't really supported in my view. (Maybe we should make configure explicitly reject it. It has a tendency to break because distros don't check the static-compilation version of their pkg-config configuration files.)

Quoted 4 lines

The former returns an empty string; the latter returns the correct library list. If it had used the latter it would work properly. There is a note in the configure effect suggesting that pig-config is preferred, but I’m not sure why that is…

pkg-config plays better with cross compilation: you have one your-architecture-pkg-config which knows about the config files for that architecture for all libraries. Having a different config script for each library makes it a huge pain to try to swap in the right one for each architecture.

(If the two give different answers this is a distro bug.)

thanks
-- PMM

#3 lore raw
Quoted 5 lines · Sam McKelvie

Apologies for breaking the thread of the discussion; still haven’t figured out how to cold-respond to a thread without an incoming email.

Thank you for your response. Indeed, for my purposes I only need the static linux-user binary, so I can just remove SDL and it’s not a problem.

You can use the --target-list=... options to configure to tell it to only build the linux-user binaries you care about, or use --disable-system --disable-tools to disable building of the system-emulation binaries and the miscellaneous standalone tools. I recommend one or the other if you're using --static (and then you should not need to uninstall SDL to build).

thanks
-- PMM