liujiusheng / blog

个人博客,blog
19 stars 0 forks source link

在Docker中的Ubuntu上编译OSGB转3dtile的工具过程记录 #221

Open liujiusheng opened 2 years ago

liujiusheng commented 2 years ago

报错1(缺少opengl)

warning: In file included from ./src/osg/osg/GLDefines:25, warning: from ./src/osg/osg/GLExtensions:18, warning: from ./src/osg/osg/Shader:25, warning: from ./src/osg/osg/StateAttribute:20, warning: from ./src/osg/osg/Material:18, warning: from ./src/shp23dtile.cpp:10: warning: ./src/osg/osg/GL:114:10: fatal error: GL/gl.h: No such file or directory warning: 114 | #include <GL/gl.h> warning: | ^~~~~ warning: compilation terminated.

error: failed to run custom build command for _3dtile v0.1.0 (/opt/tool-server/public/3dtiles)

Caused by: process didn't exit successfully: /opt/tool-server/public/3dtiles/target/release/build/_3dtile-d7434a66fec8d919/build-script-build (exit status: 1) --- stdout TARGET = Some("x86_64-unknown-linux-gnu") OPT_LEVEL = Some("3") HOST = Some("x86_64-unknown-linux-gnu") CXX_x86_64-unknown-linux-gnu = None CXX_x86_64_unknown_linux_gnu = None HOST_CXX = None CXX = None CXXFLAGS_x86_64-unknown-linux-gnu = None CXXFLAGS_x86_64_unknown_linux_gnu = None HOST_CXXFLAGS = None CXXFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("false") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "./src" "-I" "./src/osg" "-std=c++11" "-o" "/opt/tool-server/public/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/out/./src/tileset.o" "-c" "./src/tileset.cpp" exit status: 0 running: "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "./src" "-I" "./src/osg" "-std=c++11" "-o" "/opt/tool-server/public/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/out/./src/shp23dtile.o" "-c" "./src/shp23dtile.cpp" cargo:warning=In file included from ./src/osg/osg/GLDefines:25, cargo:warning= from ./src/osg/osg/GLExtensions:18, cargo:warning= from ./src/osg/osg/Shader:25, cargo:warning= from ./src/osg/osg/StateAttribute:20, cargo:warning= from ./src/osg/osg/Material:18, cargo:warning= from ./src/shp23dtile.cpp:10: cargo:warning=./src/osg/osg/GL:114:10: fatal error: GL/gl.h: No such file or directory cargo:warning= 114 | #include <GL/gl.h> cargo:warning= | ^~~~~ cargo:warning=compilation terminated. exit status: 1

--- stderr

error occurred: Command "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "./src" "-I" "./src/osg" "-std=c++11" "-o" "/opt/tool-server/public/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/out/./src/shp23dtile.o" "-c" "./src/shp23dtile.cpp" with args "c++" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish... error: build failed

系统中缺少OpenGL库

sudo apt-get install mesa-common-dev sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev

报错2,无法正确链接到文件,version报错的提示不用管,不是主要问题

warning: field is never read: version --> src/main.rs:212:5 212 pub version: String, ^^^^^^^^^^^^^^^^^^^
= note: `#[warn(dead_code)]` on by default

error: linking with cc failed: exit status: 1 | = note: "cc" "-m64" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.0.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.1.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.10.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.11.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.12.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.13.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.14.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.15.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.2.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.3.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.4.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.5.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.6.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.7.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.8.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.9.rcgu.o" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4.due37u96ixk9czf.rcgu.o" "-Wl,--as-needed" "-L" "/opt/tool-server/public/3dtiles/target/release/deps" "-L" "/opt/tool-server/public/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/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" "/opt/tool-server/public/3dtiles/target/release/deps/librayon-baeae97aa868c0f6.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/librayon_core-ed9098fe53d09e85.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libnum_cpus-d49cc7f1fb56f79a.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libcrossbeam_deque-da1c1d992820c9dc.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libcrossbeam_epoch-046d67176d97ea66.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libmemoffset-fb232aa0c2407c55.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libscopeguard-bc245dcacf977499.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libcrossbeam_channel-7b61aaffad1f79d9.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libcrossbeam_utils-d442e87e1caecb05.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/liblazy_static-a93e65d543d02ade.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libeither-fe28493ab5ac36ea.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libenv_logger-184f6c4fe3e37968.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libregex-2d43836086f4d8f1.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libaho_corasick-2c3dc7d7a204598f.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libmemchr-caa8eff4609473c1.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libregex_syntax-fa358f41e2acf7f2.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libhumantime-61811dd989dca821.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libquick_error-c8c0fdda8439e010.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libtermcolor-2746225aa61aeb85.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libchrono-8eb4207f7dfe61cb.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libnum_integer-8bfc547ec03c79f5.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libnum_traits-552e9776d9dd579e.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libtime-3bc63046cef8d302.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libbyteorder-72c11af8560f4479.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libserde_xml_rs-89ea1b8fc9ee512c.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/liblog-be23e0566b3f8c70.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/liblog-f2309293f241fc1b.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libcfg_if-84e662c384ea69ca.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libxml-99ffdecb761522eb.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libbitflags-46051a72a3bb3ee9.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libserde_json-a1c864aa10c76b55.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libryu-5e29dee970cd65aa.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libitoa-5bd564414a58e619.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libserde-b8329def2dcbace3.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libclap-bd375fcdfdfda240.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libvec_map-8682bbd4d6351216.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libtextwrap-2940ce5f7037de6a.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libunicode_width-9a11fe300fad8351.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libstrsim-67a183ab8f6285b9.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libbitflags-ace387624c249eac.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libatty-b94fbe75322dd5be.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/liblibc-4313b67f12f32049.rlib" "/opt/tool-server/public/3dtiles/target/release/deps/libansi_term-e720e62c830ae60b.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1e1088264352fcd6.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-a969816f41e59f04.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-18e12a7cddee847a.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-f32cf3bc142978d3.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-a0e394a75c0959fe.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-9b944335c98e9e5a.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-53ff769910bef363.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-99cc1718e48a21ca.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-c6d3e92e16ddaaea.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-3bca69e5bcc0a46e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-391afe94b4105cde.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e310d903422b1611.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-f892a560e94b36bb.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-89b36d2fd36f710b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3edad9197d8d2a0e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-6123b310ab5947a4.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-125fb607b0118c1e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-690babb9362d4823.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-c39f82cdaf262b3f.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" "/opt/tool-server/public/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" = note: /usr/bin/ld:./lib/libOpenThreads.so: file format not recognized; treating as linker script /usr/bin/ld:./lib/libOpenThreads.so:0: syntax error collect2: error: ld returned 1 exit status

warning: _3dtile (bin "_3dtile") generated 1 warning error: could not compile _3dtile due to previous error; 1 warning emitted

./lib/libosg.so、./lib/libosgDB.so、/lib/libosgUtil.so也有同样的问题,但是如果项目是直接从git上克隆到ubuntu上的不会有这些问题,原因是windows上无法自动为文件建立链接。

问题3,此问题无解,但看报错应该是包的版本没对上,所以考虑替换lib包,网上找的lib包可能版本还是对不上,直接自己编译会比较靠谱,编译很简单。

error: linking with cc failed: exit status: 1 | = note: "cc" "-m64" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.0.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.1.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.10.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.11.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.12.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.13.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.14.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.15.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.2.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.3.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.4.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.5.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.6.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.7.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.8.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4._3dtile.b352ded8-cgu.9.rcgu.o" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4.due37u96ixk9czf.rcgu.o" "-Wl,--as-needed" "-L" "/root/3dtiles/target/release/deps" "-L" "/root/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/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" "/root/3dtiles/target/release/deps/librayon-baeae97aa868c0f6.rlib" "/root/3dtiles/target/release/deps/librayon_core-ed9098fe53d09e85.rlib" "/root/3dtiles/target/release/deps/libnum_cpus-d49cc7f1fb56f79a.rlib" "/root/3dtiles/target/release/deps/libcrossbeam_deque-da1c1d992820c9dc.rlib" "/root/3dtiles/target/release/deps/libcrossbeam_epoch-046d67176d97ea66.rlib" "/root/3dtiles/target/release/deps/libmemoffset-fb232aa0c2407c55.rlib" "/root/3dtiles/target/release/deps/libscopeguard-bc245dcacf977499.rlib" "/root/3dtiles/target/release/deps/libcrossbeam_channel-7b61aaffad1f79d9.rlib" "/root/3dtiles/target/release/deps/libcrossbeam_utils-d442e87e1caecb05.rlib" "/root/3dtiles/target/release/deps/liblazy_static-a93e65d543d02ade.rlib" "/root/3dtiles/target/release/deps/libeither-fe28493ab5ac36ea.rlib" "/root/3dtiles/target/release/deps/libenv_logger-184f6c4fe3e37968.rlib" "/root/3dtiles/target/release/deps/libregex-2d43836086f4d8f1.rlib" "/root/3dtiles/target/release/deps/libaho_corasick-2c3dc7d7a204598f.rlib" "/root/3dtiles/target/release/deps/libmemchr-caa8eff4609473c1.rlib" "/root/3dtiles/target/release/deps/libregex_syntax-fa358f41e2acf7f2.rlib" "/root/3dtiles/target/release/deps/libhumantime-61811dd989dca821.rlib" "/root/3dtiles/target/release/deps/libquick_error-c8c0fdda8439e010.rlib" "/root/3dtiles/target/release/deps/libtermcolor-2746225aa61aeb85.rlib" "/root/3dtiles/target/release/deps/libchrono-8eb4207f7dfe61cb.rlib" "/root/3dtiles/target/release/deps/libnum_integer-8bfc547ec03c79f5.rlib" "/root/3dtiles/target/release/deps/libnum_traits-552e9776d9dd579e.rlib" "/root/3dtiles/target/release/deps/libtime-3bc63046cef8d302.rlib" "/root/3dtiles/target/release/deps/libbyteorder-72c11af8560f4479.rlib" "/root/3dtiles/target/release/deps/libserde_xml_rs-89ea1b8fc9ee512c.rlib" "/root/3dtiles/target/release/deps/liblog-be23e0566b3f8c70.rlib" "/root/3dtiles/target/release/deps/liblog-f2309293f241fc1b.rlib" "/root/3dtiles/target/release/deps/libcfg_if-84e662c384ea69ca.rlib" "/root/3dtiles/target/release/deps/libxml-99ffdecb761522eb.rlib" "/root/3dtiles/target/release/deps/libbitflags-46051a72a3bb3ee9.rlib" "/root/3dtiles/target/release/deps/libserde_json-a1c864aa10c76b55.rlib" "/root/3dtiles/target/release/deps/libryu-5e29dee970cd65aa.rlib" "/root/3dtiles/target/release/deps/libitoa-5bd564414a58e619.rlib" "/root/3dtiles/target/release/deps/libserde-b8329def2dcbace3.rlib" "/root/3dtiles/target/release/deps/libclap-bd375fcdfdfda240.rlib" "/root/3dtiles/target/release/deps/libvec_map-8682bbd4d6351216.rlib" "/root/3dtiles/target/release/deps/libtextwrap-2940ce5f7037de6a.rlib" "/root/3dtiles/target/release/deps/libunicode_width-9a11fe300fad8351.rlib" "/root/3dtiles/target/release/deps/libstrsim-67a183ab8f6285b9.rlib" "/root/3dtiles/target/release/deps/libbitflags-ace387624c249eac.rlib" "/root/3dtiles/target/release/deps/libatty-b94fbe75322dd5be.rlib" "/root/3dtiles/target/release/deps/liblibc-4313b67f12f32049.rlib" "/root/3dtiles/target/release/deps/libansi_term-e720e62c830ae60b.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1e1088264352fcd6.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-a969816f41e59f04.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-18e12a7cddee847a.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-f32cf3bc142978d3.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-a0e394a75c0959fe.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-9b944335c98e9e5a.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-53ff769910bef363.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-99cc1718e48a21ca.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-c6d3e92e16ddaaea.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-3bca69e5bcc0a46e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-391afe94b4105cde.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-e310d903422b1611.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-f892a560e94b36bb.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-89b36d2fd36f710b.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3edad9197d8d2a0e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-6123b310ab5947a4.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-125fb607b0118c1e.rlib" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-690babb9362d4823.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-c39f82cdaf262b3f.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" "/root/3dtiles/target/release/deps/_3dtile-c1dc5c1da45fb5e4" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs" = note: /usr/bin/ld: /root/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/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: /root/3dtiles/target/release/build/_3dtile-00b7a7cf6da54e1c/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)

warning: _3dtile (bin "_3dtile") generated 1 warning error: could not compile _3dtile due to previous error; 1 warning emitted

4 OSG项目地址,可以按文件编译,不容易出错,但要些时间,我的机器还不错大概1个小时

可能需要自己安装cmake工具

apt-get install -y cmake

OSG项目地址:

OSG项目地址

编译步骤:

git clone https://github.com/openscenegraph/OpenSceneGraph.git

mkdir build cd build cmake ../OpenSceneGraph

build目录下会生成lib文件夹,将lib文件夹替换3dtiles中的lib

再执行:cargo build --release命令,可编译成功。