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

ld.lld: error: undefined symbol: _pcre2_default_tables_8 #375

Closed
pommeJack opened this issue Jan 24, 2024 · 1 comment
Closed

ld.lld: error: undefined symbol: _pcre2_default_tables_8 #375

pommeJack opened this issue Jan 24, 2024 · 1 comment

Comments

@pommeJack
Copy link

I attempted to compile the 32-bit pcre2 library for an ARM architecture Linux system using cmake and clang, without making other configurations to the cmake script, and encountered the following errors:

[OHOS ERROR] [32/37] LINK common/common/pcre2posix_test
[OHOS ERROR] FAILED: common/common/pcre2posix_test exe.unstripped/common/common/pcre2posix_test 
[OHOS ERROR] /usr/bin/env "../../build/toolchain/gcc_link_wrapper.py" --output="common/common/pcre2posix_test" --strip="../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip" --unstripped-file="./exe.unstripped/common/common/pcre2posix_test"  --mini-debug -- ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -Wl,--pack-dyn-relocs=android+relr -Wl,--fatal-warnings -Wl,--build-id=md5 -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-undefined -Wl,--exclude-libs=libunwind_llvm.a -Wl,--exclude-libs=libc++_static.a -Wl,--exclude-libs=libvpx_assembly_arm.a --target=arm-linux-ohos -Werror -Wl,--warn-shared-textrel -Wl,-O2 -Wl,--gc-sections -Wl,--gdb-index --sysroot=obj/third_party/musl -nostdlib -Lobj/third_party/musl/usr/lib/arm-linux-ohos -L../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos -Wl,--warn-shared-textrel -Bdynamic -Wl,-z,nocopyreloc -pie -o "./exe.unstripped/common/common/pcre2posix_test" obj/third_party/musl/usr/lib/arm-linux-ohos/Scrt1.o obj/third_party/musl/usr/lib/arm-linux-ohos/crti.o -Wl,--start-group  @"common/common/pcre2posix_test.rsp"  -lunwind -lc++ ../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos/libclang_rt.builtins.a -lc -lc++abi -ldl -lm -Wl,--end-group  obj/third_party/musl/usr/lib/arm-linux-ohos/crtn.o
[OHOS ERROR] ld.lld: error: undefined symbol: _pcre2_default_tables_8
[OHOS ERROR] >>> referenced by pcre2_context.c
[OHOS ERROR] >>>               pcre2_context.o:(_pcre2_default_compile_context_8) in archive obj/third_party/pcre2-pcre2-10.42/libpcre2-8-static.a
[OHOS ERROR] >>> referenced by pcre2_compile.c:0 (../../third_party/pcre2-pcre2-10.42/src/pcre2_compile.c:0)
[OHOS ERROR] >>>               pcre2_compile.o:(pcre2_compile_8) in archive obj/third_party/pcre2-pcre2-10.42/libpcre2-8-static.a
[OHOS ERROR] clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
[OHOS ERROR] [33/37] LINK common/common/pcre2grep
[OHOS ERROR] FAILED: common/common/pcre2grep exe.unstripped/common/common/pcre2grep 
[OHOS ERROR] /usr/bin/env "../../build/toolchain/gcc_link_wrapper.py" --output="common/common/pcre2grep" --strip="../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/llvm-strip" --unstripped-file="./exe.unstripped/common/common/pcre2grep"  --mini-debug -- ../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang++ -Wl,--pack-dyn-relocs=android+relr -Wl,--fatal-warnings -Wl,--build-id=md5 -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-undefined -Wl,--exclude-libs=libunwind_llvm.a -Wl,--exclude-libs=libc++_static.a -Wl,--exclude-libs=libvpx_assembly_arm.a --target=arm-linux-ohos -Werror -Wl,--warn-shared-textrel -Wl,-O2 -Wl,--gc-sections -Wl,--gdb-index --sysroot=obj/third_party/musl -nostdlib -Lobj/third_party/musl/usr/lib/arm-linux-ohos -L../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos -Wl,--warn-shared-textrel -Bdynamic -Wl,-z,nocopyreloc -pie -o "./exe.unstripped/common/common/pcre2grep" obj/third_party/musl/usr/lib/arm-linux-ohos/Scrt1.o obj/third_party/musl/usr/lib/arm-linux-ohos/crti.o -Wl,--start-group  @"common/common/pcre2grep.rsp"  -lunwind -lc++ ../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/12.0.1/lib/arm-linux-ohos/libclang_rt.builtins.a -lc -lc++abi -ldl -lm -Wl,--end-group  obj/third_party/musl/usr/lib/arm-linux-ohos/crtn.o
[OHOS ERROR] ld.lld: error: undefined symbol: _pcre2_default_tables_8
[OHOS ERROR] >>> referenced by pcre2_context.c
[OHOS ERROR] >>>               pcre2_context.o:(_pcre2_default_compile_context_8) in archive obj/third_party/pcre2-pcre2-10.42/libpcre2-8-static.a
[OHOS ERROR] >>> referenced by pcre2_compile.c:0 (../../third_party/pcre2-pcre2-10.42/src/pcre2_compile.c:0)
[OHOS ERROR] >>>               pcre2_compile.o:(pcre2_compile_8) in archive obj/third_party/pcre2-pcre2-10.42/libpcre2-8-static.a
[OHOS ERROR] clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

Does anyone know why this might be happening?

@carenas
Copy link
Contributor

carenas commented Jan 25, 2024

can you show the command line / env values you used?

is it a "release" tarfile what you used or git? if the former was it 10.43RC1 and if hot could you try that?

also make sure you invoke cmake with the right toolset, it looks you were using a x86_64 crosscompiler by the output of your error.

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

2 participants