构建assimp在经过一些修改之后工作得很好,但是Readme.md对于构建assimp2json还不太清楚。
从github dot com/assimp/assimp2json生成时,将生成错误“/usr/bin/ld:cannot open output file assimp2json:Is a directory”。
当我在网上搜索这个问题时,我发现用其他软件删除冲突的目录是可以的,但在这里不是这样,内容是必需的。
同时重命名文件系统上的dir和对CMakeLists.txt中的dir的引用也不起作用,因为这会导致输出文件名更改为新的dir名。
在make手册中,我找不到更改输出路径的选项。在网上搜索之后,我又觉得被卡住了。
错误周围的sussinct输出更少:“

Linking CXX shared library ../../lib/libassimp.so
[ 97%] Built target assimp
Scanning dependencies of target assimp2json
[ 98%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/main.cpp.o
[ 98%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/json_exporter.cpp.o
[ 99%] Building C object CMakeFiles/assimp2json.dir/assimp2json/cencode.c.o
[100%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/mesh_splitter.cpp.o
Linking CXX executable assimp2json
/usr/bin/ld: cannot open output file assimp2json: Is a directory
collect2: error: ld returned 1 exit status
CMakeFiles/assimp2json.dir/build.make:162: recipe for target 'assimp2json' failed
make[2]: *** [assimp2json] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/assimp2json.dir/all' failed
make[1]: *** [CMakeFiles/assimp2json.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

".
我用来生成的命令:“
git clone https://github.com/assimp/assimp2json
cd assimp2json
git submodule init
git submodule update
cmake CMakeLists.txt
make

".
还尝试了github dot com/assimp/assimp/blob/master/INSTALL中所述的“cmake CMakeLists.txt-G‘Unix Makefiles’”,但没有成功。
由于github dot com/assimp/assimp2json是从github dot com/acgessler/assimp2json派生的,后者有更新的提交(2013年和2015年),我还尝试用相同的命令构建它。
并将assimp/cmake modules/AddGTest.cmake的第34行从“GIT_REPOSITORY chromium.googlesource dot com/external/googletest”更改为“GIT_REPOSITORY github dot com/google/googletest/”。
这有点进步,但还不够。”
Linking CXX shared library ../../lib/libassimp.so
[ 80%] Built target assimp
Scanning dependencies of target assimp2json
[ 80%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/main.cpp.o
[ 81%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/json_exporter.cpp.o
[ 81%] Building C object CMakeFiles/assimp2json.dir/assimp2json/cencode.c.o
[ 82%] Building CXX object CMakeFiles/assimp2json.dir/assimp2json/mesh_splitter.cpp.o
Linking CXX executable bin/assimp2json
[ 82%] Built target assimp2json
Scanning dependencies of target gtest
[ 82%] Creating directories for 'gtest'
[ 83%] Performing download step (git clone) for 'gtest'
-- gtest download command succeeded.  See also /opt/assimp2json/assimp/test/gtest/src/gtest-stamp/gtest-download-*.log

[ 84%] No patch step for 'gtest'
[ 84%] Performing update step for 'gtest'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
[ 84%] Performing configure step for 'gtest'
-- gtest configure command succeeded.  See also /opt/assimp2json/assimp/test/gtest/src/gtest-stamp/gtest-configure-*.log

[ 85%] Performing build step for 'gtest'
-- gtest build command succeeded.  See also /opt/assimp2json/assimp/test/gtest/src/gtest-stamp/gtest-build-*.log

[ 86%] No install step for 'gtest'
[ 86%] Completed 'gtest'
[ 86%] Built target gtest
Scanning dependencies of target unit
[ 86%] Building C object assimp/test/CMakeFiles/unit.dir/unit/CCompilerTest.c.o
[ 87%] Building CXX object assimp/test/CMakeFiles/unit.dir/unit/Main.cpp.o
In file included from /opt/assimp2json/assimp/test/unit/Main.cpp:1:0:
/opt/assimp2json/assimp/test/unit/UnitTestPCH.h:11:25: fatal error: gtest/gtest.h: No such file or directory
 #include <gtest/gtest.h>
                         ^
compilation terminated.
assimp/test/CMakeFiles/unit.dir/build.make:77: recipe for target 'assimp/test/CMakeFiles/unit.dir/unit/Main.cpp.o' failed
make[2]: *** [assimp/test/CMakeFiles/unit.dir/unit/Main.cpp.o] Error 1
CMakeFiles/Makefile2:250: recipe for target 'assimp/test/CMakeFiles/unit.dir/all' failed
make[1]: *** [assimp/test/CMakeFiles/unit.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

".
其他人有能力建立这个并愿意分享这个诀窍吗?或者其他人失败了,我应该看看其他软件吗?如有帮助,将不胜感激。

最佳答案

assimp2json:使用正确的命令在这里构建OK。。。。[100%]构建目标assimp2json

git clone https://github.com/assimp/assimp2json.git
cd assimp2json/
git submodule init
git submodule update
mkdir build
cd build/
cmake ../
make

也就是说,大多数“cmake构建”都需要一个构建/文件夹。
还有:可能你用了太晚的g++来编写三年前的代码。建议:CXX=g++-4.9 cmake ../。。。还有什么问题吗?然后请用你的操作系统名称和版本更新你的帖子。

07-26 00:01