fanvanzh / 3dtiles

The fastest tools for 3dtiles convert in the world!
Apache License 2.0
1.98k stars 594 forks source link

编译报错:error: linking with cc failed: exit status: 1,及运行报段错误 #207

Closed xyzrgba closed 3 years ago

xyzrgba commented 3 years ago

OS: Ubuntu 20.04

Compiling autocfg v1.0.1 Compiling cfg-if v1.0.0 Compiling libc v0.2.101 Compiling proc-macro2 v1.0.29 Compiling crossbeam-utils v0.8.5 Compiling unicode-xid v0.2.2 Compiling lazy_static v1.4.0 Compiling syn v1.0.76 Compiling log v0.4.14 Compiling crossbeam-epoch v0.9.5 Compiling serde_derive v1.0.130 Compiling memchr v2.4.1 Compiling serde v1.0.130 Compiling scopeguard v1.1.0 Compiling rayon-core v1.9.1 Compiling ryu v1.0.5 Compiling cc v1.0.70 Compiling unicode-width v0.1.8 Compiling quick-error v1.2.3 Compiling serde_json v1.0.67 Compiling regex-syntax v0.6.25 Compiling bitflags v0.7.0 Compiling ansi_term v0.11.0 Compiling termcolor v1.1.2 Compiling bitflags v1.3.2 Compiling either v1.6.1 Compiling itoa v0.4.8 Compiling vec_map v0.8.2 Compiling strsim v0.8.0 Compiling byteorder v1.4.3 Compiling memoffset v0.6.4 Compiling num-traits v0.2.14 Compiling num-integer v0.1.44 Compiling rayon v1.5.1 Compiling textwrap v0.11.0 Compiling humantime v1.3.0 Compiling xml-rs v0.3.6 Compiling _3dtile v0.1.0 (/home/gitee/cesium-3dtiles) Compiling crossbeam-channel v0.5.1 Compiling num_cpus v1.13.0 Compiling atty v0.2.14 Compiling time v0.1.44 Compiling log v0.3.9 Compiling quote v1.0.9 Compiling aho-corasick v0.7.18 Compiling clap v2.33.3 Compiling regex v1.5.4 Compiling crossbeam-deque v0.8.1 Compiling chrono v0.4.19 Compiling env_logger v0.5.13 Compiling serde-xml-rs v0.2.1 error: linking with cc failed: exit status: 1 | = note: "cc" "-m64" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.0.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.1.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.10.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.11.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.12.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.13.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.14.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.15.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.2.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.3.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.4.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.5.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.6.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.7.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.8.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969._3dtile.443af682-cgu.9.rcgu.o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969.mrrx6k1kg0zdc6e.rcgu.o" "-Wl,--as-needed" "-L" "/home/gitee/cesium-3dtiles/target/release/deps" "-L" "/home/gitee/cesium-3dtiles/target/release/build/_3dtile-ca068789f72c3f9d/out" "-L" "./lib" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l_3dtile" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-lstdc++" "-lOpenThreads" "-losg" "-losgDB" "-losgUtil" "-Wl,-Bstatic" "/home/gitee/cesium-3dtiles/target/release/deps/librayon-52cb3a3c0e292e82.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/librayon_core-dad337b77fc50d02.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libnum_cpus-52c4737fd96e6fd3.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libcrossbeam_deque-18592b73b8bf5e20.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libcrossbeam_epoch-c5737ecf247f0c9a.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libmemoffset-f34c0d3bba46bc01.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libscopeguard-ee11b6060c6151cd.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libcrossbeam_channel-5b3a74a748f0c886.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libcrossbeam_utils-1319570be1da921d.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/liblazy_static-fe3ffb0d817d13d7.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libeither-08f90d3f0d88bbf0.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libenv_logger-e81692bab1e03271.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libregex-751b91d68bf4c6ff.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libaho_corasick-9c0b81665be543b4.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libmemchr-4113b22321c15458.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libregex_syntax-09d5543a3c98c8ca.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libhumantime-84ac315a68fb5a75.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libquick_error-c542272a4b67d885.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libtermcolor-3401b792779e14d0.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libchrono-96363c0b06b71a82.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libnum_integer-d07b388554f4f8ec.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libnum_traits-dc9636ccfcd1f69e.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libtime-042b112c3efb8ac3.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libbyteorder-0d47512e2d5586a2.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libserde_xml_rs-692d3192469005f1.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/liblog-38decd37c1a8ad6b.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/liblog-6a4b013f5b0ce64e.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libcfg_if-f6a35cef654aa08d.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libxml-2e44ff2ac197ee72.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libbitflags-8bc3fd68a25a4d9b.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libserde_json-f104062cad3cf559.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libryu-62d8b453d69b1fd2.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libitoa-96aa63bddd0fae9b.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libserde-0955df65fc5ee82d.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libclap-86d60472e54c6a9a.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libvec_map-42adc355362c5416.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libtextwrap-b39d0db27731a433.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libunicode_width-3bf99c6b4d3f3e20.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libstrsim-cd375033641a485f.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libbitflags-258615ba0ce90d12.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libatty-8424f2d16397d09c.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/liblibc-08b6b7209eea639f.rlib" "/home/gitee/cesium-3dtiles/target/release/deps/libansi_term-1396373762392330.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-008055cc7d873802.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-06f01ac2578bda94.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f9a3c3274a1835e0.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-d4cbb754ee9f4daa.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-95c14e1c1e3ebcc4.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-d489f0ca872880cc.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-75f07df0b18fea39.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-0c35b278736219a2.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e530649c9a06e3c6.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-6b148909d375a785.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cd15fa647f4775d1.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-74be3a703f788ba2.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-8f2c5b445c28b2e3.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8480e85e0be96197.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-ac23a75f6f42004e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-557ba8776e04d182.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4beb03d03503c439.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-dd7db1bec6909f24.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/gitee/cesium-3dtiles/target/release/deps/_3dtile-b977ab0ee8494969" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" = note: /usr/bin/ld: /home/gitee/cesium-3dtiles/target/release/build/_3dtile-ca068789f72c3f9d/out/lib_3dtile.a(osgb23dtile.o): in function get_all_tree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) [clone .localalias]': osgb23dtile.cpp:(.text._Z12get_all_treeRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2cb): undefined reference toosgDB::readNodeFiles(std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::cxx11::basic_string<char, std::char_traits, std::allocator > > >&, osgDB::Options const)' /usr/bin/ld: /home/gitee/cesium-3dtiles/target/release/build/_3dtile-ca068789f72c3f9d/out/lib_3dtile.a(osgb23dtile.o): in function osgb2glb_buf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, MeshInfo&)': osgb23dtile.cpp:(.text._Z12osgb2glb_bufNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS4_R8MeshInfo+0x134): undefined reference toosgDB::readNodeFiles(std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::cxx11::basic_string<char, std::char_traits, std::allocator > > >&, osgDB::Options const)' 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 _3dtile due to previous error

xyzrgba commented 3 years ago

我编译好了一个osgPlugins-3.7.0,你知道这个放在项目哪里吗

fanvanzh commented 3 years ago

osgPlugins-3.7.0 文件夹和 libosg.so 同级目录

xyzrgba commented 3 years ago

我是直接放在lib了,然后我需要什么配置吗?cargo.lock或者是cargo.toml需要修改吗

xyzrgba commented 3 years ago

in function get_all_tree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) [clone .localalias]': osgb23dtile.cpp:(.text._Z12get_all_treeRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2cb): undefined reference toosgDB::readNodeFiles(std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::cxx11::basic_string<char, std::char_traits, std::allocator > > >&, osgDB::Options const)' /usr/bin/ld: /home/gitee/cesium-3dtiles/target/release/build/_3dtile-ca068789f72c3f9d/out/lib_3dtile.a(osgb23dtile.o): in function osgb2glb_buf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, MeshInfo&)': osgb23dtile.cpp:(.text._Z12osgb2glb_bufNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS4_R8MeshInfo+0x134): undefined reference toosgDB::readNodeFiles(std::vector<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::cxx11::basic_string<char, std::char_traits, std::allocator > > >&, osgDB::Options const)' 从错误来看,应该是没找到这个方法的声明,我不知道在ubuntu20的情况下还有哪里需要配置的

fanvanzh commented 3 years ago

osgPlugins-3.7.0 ? 用的不是 项目自带的 osg 依赖吗 ?

检查下 osg header\libs 啦, 如果你升级了 osg 库, 我不确认项目中用的 osg 函数是否有兼容性问题。

xyzrgba commented 3 years ago

我没有升级osg的版本之前是报这个错误的

xyzrgba commented 3 years ago

我把编译后的osg的lib直接替换项目的lib,然后编译成功。

Dingtalk_20210915115829

xyzrgba commented 3 years ago

但是我在使用的过程中报错了Segmentation fault (core dumped) Dingtalk_20210915115810 使用gdb调试后,出现以下错误

Dingtalk_20210915143153

fanvanzh commented 3 years ago

没有找到 osg 的 plugin 目录

xyzrgba commented 3 years ago

你说的是没有找到lib/osgPlugins-3.7.0吗? 微信截图_20210916142007

我把lib/osgPlugins-3.7.0加入到 LD_LIBRARY_PATH中,依旧在报错。 微信截图_20210916142938 微信截图_20210916143135

fanvanzh commented 3 years ago

把 osgPlugins-3.7.0 目录放到和 _3dtile 同目录呢? osg 可能是搜索 current_directory 来查找 plugins 的。

xyzrgba commented 3 years ago

我试了一下,还是一样的报错

xyzrgba commented 3 years ago

我觉得代码在Linux下存在内存越界的问题,我现在看太懂rust和c++

xyzrgba commented 3 years ago

我下午定位了了这里报错,但是看不太懂

Dingtalk_20210917155140 Dingtalk_20210917155153 Dingtalk_20210917155207

xyzrgba commented 3 years ago

这是测试文件,及一些测试信息

Dingtalk_20210917170806

1

此时,我的no已经打印出来了,但是我的yes一个都没有,应该是这里错了

Dingtalk_20210917171854

fanvanzh commented 3 years ago

参考 How to build / Linux 的说明

xyzrgba commented 3 years ago

在编译对应版本的osg后,lib替换原来的lib包,同时将osg的include替换项目中src/osg中的全部文件。 非常感谢作者

LYP857 commented 11 months ago

@xyzrgba 大哥,你这个问题是解决了吗,我也报了同样的错误,但是按照你的方法把osgb依赖都加进去后,还是报错 ./target/release/_3dtile -f osgb -i ./test -o ../output 能详细说一下你怎么解决的吗

xyzrgba commented 11 months ago

@LYP857 master分支是windows的环境下编译的,如果需要在linux编译可以使用 linux_osg_370分支; 我当初遇到这个问题是头文件报错的,也就是把master分支放到了linux环境下编译了