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

v8 11.8.172支持linux的ue #16

Open
chexiongsheng opened this issue Jul 29, 2024 · 2 comments
Open

v8 11.8.172支持linux的ue #16

chexiongsheng opened this issue Jul 29, 2024 · 2 comments

Comments

@chexiongsheng
Copy link
Contributor

主要有两个问题:
1、链接的是libstdc++,但ue链接的是libc++,9.4、8.4都没这问题,但10.6以上都是链接libstdc++;
2、11.8用clang 17编译,链接到ue会报Undefined symbols "std::__1::__libcpp_verbose_abort(char const*, ...)

@chexiongsheng
Copy link
Contributor Author

对于1,原以为降级到9.4用的clang(通过DEPS修改)能解决,实际上并不能,包括把sysroot也降级了也不行,不知道为何9.4编译就是libc++,最后面通过加入-stdlib=libc++显式指定,但又带来新问题,会找不到c++的头文件,切换到系统的clang++也一样,最终找到是-no-canonical-prefixes编译参数所致,该参数google也搜索不到。
对于2,降级clang可以解决。

最终形成方案1:
1、使用系统的clang 14(编辑参数加上:use_sysroot=false use_glib=false clang_base_path="/usr");由于没有v8定制的plugin,所以加上 simple_template_names=false clang_use_chrome_plugins=false ;
2、由于降级clang 14,需要去掉构建文件中不支持的编译选项:-Wno-deprecated-builtins、-Wno-deprecated-non-prototype
3、由于ue用的是c++17,稳妥起见,也改为使用c++17编译

@chexiongsheng
Copy link
Contributor Author

方案2思路是还使用clang 17(不过得改为用系统的,而不是v8自己下载的),并且通过-D_LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT=1解决符号问题:

1、config/compiler/build.gn 加入:-stdlib=libc++ -D_LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT=1
2、

if [ "$VERSION" == "11.8.172" ]; then 
    echo "============ intall clang-17"
    sudo apt update
    sudo apt install -y wget gnupg lsb-release software-properties-common
    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
    sudo add-apt-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-17 main"
    sudo apt update
    sudo apt install -y clang-17 libc++-17-dev libc++abi-17-dev
    ln -s /usr/lib/llvm-17 ~/customclang
fi

export LD_LIBRARY_PATH=$(HOME)/lib:$LD_LIBRARY_PATH
gn gen out.gn/x64.release --args="is_debug=false v8_enable_i18n_support=false v8_use_snapshot=true v8_use_external_startup_data=false v8_static_library=true strip_debug_info=true symbol_level=0 libcxx_abi_unstable=false v8_enable_pointer_compression=true v8_enable_sandbox=false use_custom_libcxx=false is_clang=true clang_use_chrome_plugins=false use_sysroot=false use_glib=false clang_base_path=\"$(HOME)/customclang\""

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

1 participant