We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
新世界使用 rust 编译 librsvg,在编译其中一个库 proc-macro2 时,在链接阶段报错: undefined reference to main
proc-macro2
undefined reference to main
详细信息如下:
error: linking with `cc` failed: exit status: 1 | = note: "cc" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.0.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build /proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.1.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_s cript_build.e30a32e1-cgu.10.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.11.rcgu.o" "/archlinux/build/librsvg/src/librsv g/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.12.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4 b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.13.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.14.rcgu.o" "/archlinux/b uild/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.15.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1 e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.2.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.3. rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.4.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-m acro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.5.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_b uild.e30a32e1-cgu.6.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.7.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/ release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.build_script_build.e30a32e1-cgu.8.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27d cd1e6.build_script_build.e30a32e1-cgu.9.rcgu.o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6.23ewl4ikofxq5i5v.rcgu.o" "-Wl,--as-needed" "-L" "/archlinux/build/l ibrsvg/src/librsvg/target/release/deps" "-L" "/usr/lib64/rustlib/loongarch64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libstd-e45cf875b9375bb0.rlib" "/usr/lib/rustlib/loon garch64-unknown-linux-gnu/lib/libpanic_unwind-01ed1759f346a29f.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libminiz_oxide-95731f3f5bdd5286.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libadler-fb646b0162bea90e.rl ib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libobject-efb6496e33c03c13.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libmemchr-6be70ae260cf41b4.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libaddr2line- de981609553d1179.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libgimli-5ec606accfe21773.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libstd_detect-7a92f7b8f5083e0e.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux -gnu/lib/librustc_demangle-8b489dc20266b0e9.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libhashbrown-12918ac802989fe3.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-f7d9b047dd68e7d7.rli b" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libunwind-937da1471c4aaa24.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libcfg_if-5e13808e7d636159.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/liblibc-7b79b1 f641133a96.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/liballoc-304a2d21d195bc36.rlib" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/librustc_std_workspace_core-f6725d145d7e6d85.rlib" "/usr/lib/rustlib/loongarch64-unkno wn-linux-gnu/lib/libcore-b7107a83be44bb5a.rlib" "-Wl,--end-group" "/usr/lib/rustlib/loongarch64-unknown-linux-gnu/lib/libcompiler_builtins-f71783c5179395b9.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-lu til" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/lib64/rustlib/loongarch64-unknown-linux-gnu/lib" "-o" "/archlinux/build/librsvg/src/librsvg/target/release/build/proc-macro2-4b2f7c5e27dcd1e6/build_script_build-4b2f7c5e27dcd1e6" "-W l,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" = note: /usr/bin/ld: /usr/lib/gcc/loongarch64-unknown-linux-gnu/12.0.1/../../../../lib64/Scrt1.o: in function `L0': /archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: undefined reference to `main' /usr/bin/ld: /archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: undefined reference to `main' /usr/bin/ld: /archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: undefined reference to `main' /usr/bin/ld: /archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: undefined reference to `main' /usr/bin/ld: /archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: undefined reference to `main' /usr/bin/ld: /usr/lib/gcc/loongarch64-unknown-linux-gnu/12.0.1/../../../../lib64/Scrt1.o:/archlinux/build/glibc/src/glibc-2.35/csu/../sysdeps/loongarch/start.S:49: more undefined references to `main' follow collect2: error: ld returned 1 exit status = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified = note: use the `-l` flag to specify native libraries to link = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname) error: could not compile `proc-macro2` due to previous error
这个情况感觉跟 aarch64 上这个注释说的情况很像:
glibc/sysdeps/aarch64/start.S
Lines 86 to 94 in 02cae44
系统中使用的 gcc 确实也启用了--enable-static-pie:
--enable-static-pie
$ gcc -v 使用内建 specs。 COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/loongarch64-unknown-linux-gnu/12.0.1/lto-wrapper 目标:loongarch64-unknown-linux-gnu 配置为:/archlinux/build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,lto,objc,obj-c++ --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-static-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --disable-multiarch --enable-plugin --enable-shared --enable-threads=posix --enable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --enable-link-serialization=1 --enable-tls --disable-werror 线程模型:posix Supported LTO compression algorithms: zlib zstd gcc 版本 12.0.1 20220317 (experimental) (GCC)
请确认这是否是个 bug,谢谢
The text was updated successfully, but these errors were encountered:
No branches or pull requests
新世界使用 rust 编译 librsvg,在编译其中一个库
proc-macro2
时,在链接阶段报错:undefined reference to main
详细信息如下:
这个情况感觉跟 aarch64 上这个注释说的情况很像:
glibc/sysdeps/aarch64/start.S
Lines 86 to 94 in 02cae44
系统中使用的 gcc 确实也启用了
--enable-static-pie
:请确认这是否是个 bug,谢谢
The text was updated successfully, but these errors were encountered: