error: undefined symbol: std::__1::basic_string when building shared library

1,485 views
Skip to first unread message

ar...@drive.ai

unread,
Jul 31, 2018, 4:31:23 PM7/31/18
to discuss-webrtc
Hi, 
I am building a dead simple shared library using GN, and I am getting this error because I don't have the standard library in my dependency tree.

I would like to know what deps I should add to have the standard library but not boringssl? (I want to build a shared library that will depends on the real openssl library).

root@8790fc1eb791:/webrtc/src/out/Default# ninja -C . libsig
ninja: Entering directory `.'
[1/1] Regenerating ninja files
[2/2] SOLINK ./libsig.so
FAILED: libsig.so libsig.so.TOC
python "../../build/toolchain/gcc_solink_wrapper.py" --readelf="readelf" --nm="nm" --sofile="./libsig.so" --tocfile="./libsig.so.TOC" --output="./libsig.so"  -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--no-as-needed -lpthread -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -m64 -Werror -Wl,--gdb-index -Wl,--fatal-warnings -nostdlib++ --sysroot=../../build/linux/debian_stretch_amd64-sysroot -L../../build/linux/debian_stretch_amd64-sysroot/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_amd64-sysroot/lib/x86_64-linux-gnu -L../../build/linux/debian_stretch_amd64-sysroot/usr/lib/x86_64-linux-gnu -Wl,-rpath-link=../../build/linux/debian_stretch_amd64-sysroot/usr/lib/x86_64-linux-gnu -o "./libsig.so" -Wl,-soname="libsig.so" @"./libsig.so.rsp"
/webrtc/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)
>>> referenced by string:1571 (../../buildtools/third_party/libc++/trunk/include/string:1571)
>>>               obj/examples/libsig/signaling.o:(driveai::signaling::Signaling::SignIn())

/webrtc/src/out/Default/../../third_party/llvm-build/Release+Asserts/bin/ld.lld: error: undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()
>>> referenced by signaling.cc:12 (../../examples/peerconnection/client/signaling/signaling.cc:12)
>>>               obj/examples/libsig/signaling.o:(driveai::signaling::Signaling::SignIn())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
root@8790fc1eb791:/webrtc/src/out/Default#

My GN file is (examples/BUILD.gn) from the webrtc tree:

  rtc_shared_library("libsig") {
    
    sources = [
      "peerconnection/client/signaling/signaling.cc"
    ]
    libs = [
      "/usr/lib/x86_64-linux-gnu/libssl.a"
    ]
  }

It get the same error if I replace "rtc_shared_library" by "shared_library".

It goes away if I depends on :
        deps = [
      "../rtc_base:rtc_base",
    ]


Thanks.

The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

Aric Lasry

unread,
Jul 31, 2018, 4:44:36 PM7/31/18
to discuss...@googlegroups.com
fixed it :

        deps = [
      "//buildtools/third_party/libc++:libc++",
    ]

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/35337e1f-328a-4211-bccf-c2a0d6a7ff6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages