Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang 18 fails to link Object::get<Object> #117

Open
heinezen opened this issue May 25, 2024 · 0 comments
Open

clang 18 fails to link Object::get<Object> #117

heinezen opened this issue May 25, 2024 · 0 comments
Labels
bug does not work as we'd expect it

Comments

@heinezen
Copy link
Member

I just tried to build openage with clang 18 and there is an error in the linker stage with nyan.

[  0%] Linking CXX shared library libopenage.so
/media/christoph/LinuxDat/Git-Repositories/openage-testing/libopenage/main/demo/pong/gamestate.cpp:124: Fehler: undefined reference to '_ZNK4nyan6Object3getITkNS_9ValueLikeES0_EESt10shared_ptrIT_ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libopenage/CMakeFiles/libopenage.dir/build.make:6192: libopenage/libopenage.so.0] Fehler 1
make[2]: *** [CMakeFiles/Makefile2:3703: libopenage/CMakeFiles/libopenage.dir/all] Fehler 2
make[1]: *** [Makefile:166: all] Fehler 2
make: *** [Makefile:36: build] Fehler 2

The culprit is this line of code:

this->ballcfg = *gamecfg.get<nyan::Object>("ball");

The function it can't reference is

nyan/nyan/object.h

Lines 375 to 380 in e09e965

/**
* Specialization of the get function to generate a nyan::Object
* from the ObjectValue that is stored in a value.
*/
template <>
std::shared_ptr<Object> Object::get<Object>(const memberid_t &member, order_t t) const;

Changing the code in openage to

this->ballcfg = gamecfg.get_object("ball");

solves the problem, so the problem is the template function sigature.

Note that I did not build nyan with clang, but that was never a problem before and I assume it's unrelated.

@heinezen heinezen added the bug does not work as we'd expect it label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug does not work as we'd expect it
Projects
None yet
Development

No branches or pull requests

1 participant