Skip to content

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

Open
@heinezen

Description

@heinezen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdoes not work as we'd expect it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions