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

Undefined symbol when linking with LLD #167

Closed
ViNi-Arco opened this issue Apr 14, 2024 · 9 comments
Closed

Undefined symbol when linking with LLD #167

ViNi-Arco opened this issue Apr 14, 2024 · 9 comments

Comments

@ViNi-Arco
Copy link

Hi, I'm building with Clang/LLVM/LLD 17.0.6, both the latest release 58 and git master are giving this error:

ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::append(char const*)
>>> referenced by INIReader.cpp
>>>               libINIReader.so.0.p/cpp_INIReader.cpp.o:(INIReader::ValueHandler(void*, char const*, char const*, char const*))
>>> referenced by INIReader.cpp
>>>               libINIReader.so.0.p/cpp_INIReader.cpp.o:(INIReader::ValueHandler(void*, char const*, char const*, char const*))

ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::append(char const*, unsigned long)
>>> referenced by INIReader.cpp
>>>               libINIReader.so.0.p/cpp_INIReader.cpp.o:(INIReader::MakeKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&))
@ViNi-Arco ViNi-Arco changed the title Undefined symbol error when linking the LLD Undefined symbol when linking with LLD Apr 14, 2024
@benhoyt
Copy link
Owner

benhoyt commented Apr 14, 2024

Ah, the beauty of C++ error messages ... I actually have no idea what this error means. Are you linking to the right C++ runtime libs?

@ViNi-Arco
Copy link
Author

ViNi-Arco commented Apr 15, 2024

Are you linking to the right C++ runtime libs?

Yes, I'm passing libc++ to meson -D buildtype=plain -Dcpp_args='-O2 -stdlib=libc++', removing it allows me to build inih, which makes it use gcc libstdc++, is INIReader.cpp incompatible with LLVM libc++?

@benhoyt
Copy link
Owner

benhoyt commented Apr 18, 2024

Yeah, I guess so! I'm not sure, though -- I'll leave this open in case you get a chance to dig further or somebody else has an idea.

@neheb
Copy link

neheb commented Aug 11, 2024

@ViNi-Arco I just tried this on Alpine with

env CC_LD=lld CXX_LD=lld CC=clang CXX=clang++ CXXFLAGS=-stdlib=libc++ meson a
meson compile -C a

compiles

@neheb
Copy link

neheb commented Aug 11, 2024

Oh this was fixed by #165

@benhoyt
Copy link
Owner

benhoyt commented Aug 11, 2024

@neheb Oh, the linking issue was fixed by making it protected?

@neheb
Copy link

neheb commented Aug 11, 2024

I mean the error message errors on

ValueHandler
MakeKey

which are now protected instead of private.

edit: actually maybe not...

edit2: yeah nvm this post was made after that commit.

@neheb
Copy link

neheb commented Aug 12, 2024

I added CI locally to try and see if I can replicate. Nope: https://github.com/neheb/inih/actions/runs/10345239206

I'd close this.

@benhoyt
Copy link
Owner

benhoyt commented Aug 12, 2024

Thanks. Closing as it seems like #165 fixed this.

@benhoyt benhoyt closed this as completed Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants