Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

build_linux.py clang verison of libowt.a cause memory issue #692

Open
chenhequn opened this issue Feb 28, 2023 · 4 comments
Open

build_linux.py clang verison of libowt.a cause memory issue #692

chenhequn opened this issue Feb 28, 2023 · 4 comments

Comments

@chenhequn
Copy link

chenhequn commented Feb 28, 2023

I changed scripts/build_linux.py to build with clang, but when I include libowt.a, app crash.

{
 # Disable usage of GTK.
     'rtc_use_gtk=false',
     # When is_clang is false, we're not using sysroot in tree.
-    'use_sysroot=false',
+    #'use_sysroot=false',
     # For Linux build we expect application built with gcc/g++. Set SDK to use
     # the same toolchain.
-    'is_clang=false',
+    #'is_clang=false',
     # Upstream only officially supports clang, so we need to suppress warnings
     # to avoid gcc/g++ specific build errors.
     'treat_warnings_as_errors=false',
}

Thread 2 "conf_sample" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff5fa6700 (LWP 6510)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff65fb7f1 in __GI_abort () at abort.c:79
#2 0x00007ffff7bc396b in ?? () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1
#3 0x00007ffff7bac9cf in ?? () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1
#4 0x00007ffff7bc2b23 in ?? () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1
#5 0x00007ffff7bc5966 in ?? () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1
#6 0x00007ffff7bc58ed in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1
#7 0x00007ffff7bc5518 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libc++abi.so.1

@chenhequn
Copy link
Author

@jianjunz Is there any solution?

@chenhequn
Copy link
Author

using CMAKE_CXX_FLAGS -O0, the error is in sdputils.cc:14, which is a static const map:
#13 0x00000000004704bd in __cxx_global_var_init () at ../../talk/owt/sdk/base/sdputils.cc:14

(gdb) bt
#0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:282
#1 0x00000000004e65d7 in std::__1::char_traits::copy (__s1=0x2627448 "", __s2=0x400003100000006 <error: Cannot access memory at address 0x400003100000006>, __n=1)
at ../../buildtools/third_party/libc++/trunk/include/__string:225
#2 0x00000000004e6214 in std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::__init (this=0x2627448,
__s=0x400003100000006 <error: Cannot access memory at address 0x400003100000006>, __sz=1) at ../../buildtools/third_party/libc++/trunk/include/string:1792
#3 0x00000000004e605a in std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string (this=0x2627448, __str=...)
at ../../buildtools/third_party/libc++/trunk/include/string:1838
__last=0x7fffffffe0d0) at ../../buildtools/third_party/libc++/trunk/include/unordered_map:1624
#12 0x00000000005014ca in std::__1::unordered_map<owt::base::AudioCodec, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, owt::base::EnumClassHash, std::__1::equal_toowt::base::AudioCodec, std::__1::allocator<std::__1::pair<owt::base::AudioCodec const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const> > >::unordered_map (
this=0x24ff3f0 owt::base::audio_codec_names, __il=) at ../../buildtools/third_party/libc++/trunk/include/unordered_map:1565
#13 0x00000000004704bd in __cxx_global_var_init () at ../../talk/owt/sdk/base/sdputils.cc:14
#14 0x00000000004706c9 in _GLOBAL__sub_I_sdputils.cc ()

@jianjunz
Copy link
Collaborator

jianjunz commented Mar 2, 2023

If is_clang=true and use_sysroot=true, it uses a prebuilt clang binary, which could be different from your system's clang.

@chenhequn
Copy link
Author

I need to build libwebrtc.a as a plugin to integrated with Unreal.
how to build with system's clang?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants