2
votes

I'm trying to get a premake4 helloworld c++ working but get an error when invoking make with release config after the makefile is created with premake. (I'm using clang on osx 10.9.4) Calling make config=release produces:

ld: internal error: atom not found in symbolIndex(...

If I add the "Symbols" flag to the release flags everything works fine. But this of course creates debug symbols.

premake4.lua:

solution "cpp_hello_world"
configurations { "Debug", "Release"}

project "cpp_hello_world.out"
kind "ConsoleApp"
language "C++"
files { "**.cpp" }

buildoptions { "-std=c++1y" } 

configuration "Debug"
defines { "DEBUG" }
flags { "Symbols" }

configuration "Release"
defines { "NDEBUG" }
flags { "Optimize" }

main.cpp:

#include <iostream>

int main(){
    std::cout << "hello world" << std::endl;
    return 0;
}

Any idea why it does not work like in the standard example? http://industriousone.com/post/typical-c-project-0

complete output using make config=release verbose=1:

==== Building cpp_hello_world.out (release) ====
Creating obj/Release
mkdir -p obj/Release
main.cpp
c++ -MMD -MP -DNDEBUG   -O2 -std=c++1y  -o "obj/Release/main.o" -c "main.cpp"
Linking cpp_hello_world.out
c++ -o ./cpp_hello_world.out obj/Release/main.o  -Wl,-x
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)
make[1]: *** [cpp_hello_world.out] Error 1
make: *** [cpp_hello_world.out] Error 2
1
in buildoptions, what does c++1y mean? - kobigurk
clang.llvm.org/cxx_status.html "C++1y implementation status Clang 3.4 and later implement all of the Draft International Standard (see most recent publicly available draft) of the upcoming C++ language standard..." - 0ax1
it does not change anything about the build error if I remove the flag - 0ax1
It works here on windows with MinGW... Can you provide the output of make config=release verbose=1 to have extra information. - Jarod42
Can you try the command c++ -o ./cpp_hello_world.out obj/Release/main.o (without the -Wl,-x) ? maybe related to x-link-flag-causing-link-errors-on-mac-osx-10-9-bug - Jarod42

1 Answers

0
votes

I was able to reproduce the error on my mac, OS X 10.10.2, using Premake4. The problem is with your project name, which shouldn't have a .out extension. Try renaming project to "cpp_hello_world" in your premake4.lua file instead.

i.e. line 4 should read:

    project "cpp_hello_world"

I can test and troubleshoot on a VM on 10.9.4 if you continue to encounter problems after making this change - let me know!