Jump to content
Eternal Lands Official Forums
Llywar

Fix for building with --as-needed

Recommended Posts

Gentoo is trying to move to building packages with --as-needed by default (simplifies library upgrades when sonames change, and also improves launch times).

 

However, eternal lands does not build with --as-needed. With this flag the linker is sensitive to the command-line order of libraries - they must follow the objects they are needed for, otherwise the linker just discards them and you get unresolved symbols.

 

A quick fix is to edit the Makefile to replace:

@$(LINK) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS)

with:

@$(LINK) $(CFLAGS) -o $(EXE) $(OBJS) $(LDFLAGS)

 

More ideally, the libraries should be put in a separate variable so that LDFLAGS can still be used for anything that must go earlier on the command line.

 

Gentoo is already patching this now, but it would be nice to have this fixed upstream. I understand other distros are starting to use --as-needed as well.

Share this post


Link to post
Share on other sites
A quick fix is to edit the Makefile to replace:

@$(LINK) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS)

with:

@$(LINK) $(CFLAGS) -o $(EXE) $(OBJS) $(LDFLAGS)

I'm committed that change. As for separating out LDFLAGS, there are only -L and -l parameters currently. Some are generated, e.g. "sdl-config --libs" which output both parts so it would be tricky to separate.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×