premake / premake/premake-core

can I remove '-Wl,-x' from ALL_LDFLAGS when leaving off the "Symbols" flag?

Open
#133 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement question
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

I'm using Premake5 (stable and nightly) for gmake on mac 10.9.5 (clang 5.1).

Basing my premake file off the 'first scriI noticed that with a super simple c++ hello world file, I was able to run the make file for debug, but not for release. In release I would get a linker error:

ld: internal error: atom not found in symbolIndex(__ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The only difference between the debug and release configuration in my premake5.lua file is that debug has flags { "Symbols" } while release does not. It seems that when this flag is left off for a given configuration, it has -Wl,-x appended to the ALL_LDFLAGS variable in the resulting make file.

-Wl,-x is what is causing this linker error. It seems to be a known issue for clang on mac 10.9, but has yet to be fixed. In the meantime, I would like to know if there is a way for me to prevent premake from adding this flag.

For reference, here are my premake5.lua file and the resulting project makefile, after running premake5 gmake.

TL;DR

How can I prevent -Wl,-x from being added to the ALL_LDFLAGS makefile variable? I don't think always adding the Symbols flag is an acceptable workaround, since I may not want to use the -g compiler flag in a release build.


_EDIT_: I'm not sure, but this issue on the old forums seems to be similar: http://industriousone.com/topic/how-remove-flags-ldflags, although the end of the thread seems to indicate that the issue was fixed in revision 23d8ffcc9144.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked premake5.lua and generated project makefile, comparing the Debug and Release ALL_LDFLAGS values and the Symbols flag. Trace where the missing Symbols setting causes -Wl,-x to be added, then verify the generated makefile no longer triggers the reported macOS linker error without requiring -g.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.