如何解决 Blender 100% 编译时出现 ld 错误“未定义引用”的问题

如何解决 Blender 100% 编译时出现 ld 错误“未定义引用”的问题

我试图按照以下步骤在计算机上安装干净的搅拌机这个网页

在 make 命令之后的网页的构建步骤中,构建崩溃了:

$ cd ~/blender-git/blender
$ make
[  1%] Built target bf_intern_clog
[ ...] Other succesful steps
[100%] Linking CXX executable ../../bin/blender
../../lib/libbf_intern_iksolver.a(IK_Solver.cpp.o):IK_Solver.cpp:function IK_FreeSolver: error: undefined reference to 'IK_QJacobian::~IK_QJacobian()'
../../lib/libbf_intern_iksolver.a(IK_Solver.cpp.o):IK_Solver.cpp:function IK_FreeSolver: error: undefined reference to 'IK_QJacobian::~IK_QJacobian()'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::IK_QJacobianSolver(): error: undefined reference to 'IK_QJacobian::IK_QJacobian()'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::IK_QJacobianSolver(): error: undefined reference to 'IK_QJacobian::IK_QJacobian()'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Setup(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >&): error: undefined reference to 'IK_QJacobian::ArmMatrices(int, int)'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Setup(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >&): error: undefined reference to 'IK_QJacobian::SetDoFWeight(int, double)'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Setup(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >&): error: undefined reference to 'IK_QJacobian::ArmMatrices(int, int)'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Solve(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >, double, int): error: undefined reference to 'IK_QJacobian::Invert()'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Solve(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >, double, int): error: undefined reference to 'IK_QJacobian::SubTask(IK_QJacobian&)'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::Solve(IK_QSegment*, std::list<IK_QTask*, std::allocator<IK_QTask*> >, double, int): error: undefined reference to 'IK_QJacobian::AngleUpdateNorm() const'
../../lib/libbf_intern_iksolver.a(IK_QJacobianSolver.cpp.o):IK_QJacobianSolver.cpp:function IK_QJacobianSolver::IK_QJacobianSolver() [clone .cold]: error: undefined reference to 'IK_QJacobian::~IK_QJacobian()'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QElbowSegment::UpdateAngle(IK_QJacobian const&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, bool*): error: undefined reference to 'IK_QJacobian::AngleUpdate(int) const'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QElbowSegment::UpdateAngle(IK_QJacobian const&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, bool*): error: undefined reference to 'IK_QJacobian::AngleUpdate(int) const'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QTranslateSegment::UpdateAngle(IK_QJacobian const&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, bool*): error: undefined reference to 'IK_QJacobian::AngleUpdate(int) const'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QSwingSegment::Lock(int, IK_QJacobian&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&): error: undefined reference to 'IK_QJacobian::Lock(int, double)'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QSphericalSegment::Lock(int, IK_QJacobian&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&): error: undefined reference to 'IK_QJacobian::Lock(int, double)'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QRevoluteSegment::UpdateAngle(IK_QJacobian const&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, bool*): error: undefined reference to 'IK_QJacobian::AngleUpdate(int) const'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QRevoluteSegment::Lock(int, IK_QJacobian&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&): error: undefined reference to 'IK_QJacobian::Lock(int, double)'
../../lib/libbf_intern_iksolver.a(IK_QSegment.cpp.o):IK_QSegment.cpp:function IK_QSwingSegment::Lock(int, IK_QJacobian&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&): error: undefined reference to 'IK_QJacobian::Lock(int, double)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QOrientationTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetBetas(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QOrientationTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetDerivatives(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, double)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QOrientationTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetDerivatives(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, double)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QPositionTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetBetas(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QPositionTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetDerivatives(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, double)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QPositionTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetDerivatives(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, double)'
../../lib/libbf_intern_iksolver.a(IK_QTask.cpp.o):IK_QTask.cpp:function IK_QCenterOfMassTask::ComputeJacobian(IK_QJacobian&): error: undefined reference to 'IK_QJacobian::SetBetas(int, int, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
../../lib/libbf_intern_libmv.a(homography.cc.o):homography.cc:function libmv_homography2DFromCorrespondencesEuc: error: undefined reference to 'libmv::EstimateHomographyOptions::EstimateHomographyOptions()'
../../lib/libbf_intern_libmv.a(homography.cc.o):homography.cc:function libmv_homography2DFromCorrespondencesEuc: error: undefined reference to 'libmv::EstimateHomography2DFromCorrespondences(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, libmv::EstimateHomographyOptions const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(initialize_reconstruction.cc.o):initialize_reconstruction.cc:function libmv::EuclideanReconstructTwoFrames(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::EuclideanReconstruction*): error: undefined reference to 'libmv::NormalizedEightPointSolver(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(initialize_reconstruction.cc.o):initialize_reconstruction.cc:function libmv::EuclideanReconstructTwoFrames(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::EuclideanReconstruction*): error: undefined reference to 'libmv::FundamentalToEssential(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(initialize_reconstruction.cc.o):initialize_reconstruction.cc:function libmv::EuclideanReconstructTwoFrames(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::EuclideanReconstruction*): error: undefined reference to 'libmv::MotionFromEssentialAndCorrespondence(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*, Eigen::Matrix<double, 3, 1, 0, 3, 1>*)'
../../lib/libbf_intern_libmv.a(initialize_reconstruction.cc.o):initialize_reconstruction.cc:function libmv::ProjectiveReconstructTwoFrames(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::ProjectiveReconstruction*): error: undefined reference to 'libmv::NormalizedEightPointSolver(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(initialize_reconstruction.cc.o):initialize_reconstruction.cc:function libmv::ProjectiveReconstructTwoFrames(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::ProjectiveReconstruction*): error: undefined reference to 'libmv::ProjectionsFromFundamental(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 4, 0, 3, 4>*, Eigen::Matrix<double, 3, 4, 0, 3, 4>*)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::EstimateHomographyOptions::EstimateHomographyOptions()'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::EstimateHomography2DFromCorrespondences(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, libmv::EstimateHomographyOptions const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::EstimateFundamentalOptions::EstimateFundamentalOptions()'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::EstimateFundamentalFromCorrespondences(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, libmv::EstimateFundamentalOptions const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::SymmetricGeometricDistance(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::SymmetricEpipolarDistance(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::FundamentalToEssential(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*)'
../../lib/libbf_intern_libmv.a(keyframe_selection.cc.o):keyframe_selection.cc:function libmv::SelectKeyframesBasedOnGRICAndVariance(libmv::Tracks const&, libmv::CameraIntrinsics const&, std::vector<int, Eigen::aligned_allocator<int> >&): error: undefined reference to 'libmv::MotionFromEssentialAndCorrespondence(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 2, 1, 0, 2, 1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*, Eigen::Matrix<double, 3, 1, 0, 3, 1>*)'
../../lib/libbf_intern_libmv.a(resect.cc.o):resect.cc:function libmv::EuclideanResect(std::vector<libmv::Marker, Eigen::aligned_allocator<libmv::Marker> > const&, libmv::EuclideanReconstruction*, bool): error: undefined reference to 'libmv::euclidean_resection::EuclideanResection(Eigen::Matrix<double, 2, -1, 0, 2, -1> const&, Eigen::Matrix<double, 3, -1, 0, 3, -1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*, Eigen::Matrix<double, 3, 1, 0, 3, 1>*, libmv::euclidean_resection::ResectionMethod)'
../../lib/libbf_intern_libmv.a(track_region.cc.o):track_region.cc:function libmv::(anonymous namespace)::ComputeCanonicalHomography(double const*, double const*, int, int): error: undefined reference to 'libmv::Homography2DFromCorrespondencesLinear(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*, double)'
../../lib/libbf_intern_libmv.a(track_region.cc.o):track_region.cc:function libmv::(anonymous namespace)::HomographyWarp::HomographyWarp(double const*, double const*, double const*, double const*): error: undefined reference to 'libmv::Homography2DFromCorrespondencesLinear(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, 3, 3, 0, 3, 3>*, double)'
collect2: error: ld returned 1 exit status
source/creator/CMakeFiles/blender.dir/build.make:580: recipe for target 'bin/blender' failed
make[3]: *** [bin/blender] Error 1
CMakeFiles/Makefile2:8857: recipe for target 'source/creator/CMakeFiles/blender.dir/all' failed
make[2]: *** [source/creator/CMakeFiles/blender.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make[1]: *** [all] Error 2
GNUmakefile:340: recipe for target 'all' failed
make: *** [all] Error 2

我怀疑我的 IK_xxx.cpp 形式的文件有问题?有人对我应该如何进行有建议吗?

检查该/lib文件夹后,似乎没有该名称的子文件夹libbf_intern_iksolver

lib/linux_centos7_x86_64$ ls -a
.        fftw3     llvm         openimagedenoise  potrace  tbb
..       freetype  mesa         openimageio       pugixml  tiff
alembic  glew      nanovdb      openjpeg          python   usd
blosc    gmp       openal       opensubdiv        sdl      xml2
boost    haru      opencollada  openvdb           sndfile  xr_openxr_sdk
embree   jemalloc  opencolorio  osl               spnav    zlib
ffmpeg   jpeg      openexr      png               .svn     zstd

答案1

最后一条错误消息表示链接时未找到某些内容,但否则构建一切正常。奇怪的。

也许某些库(错误中提到的库)是错误的版本?或者某处缺少什么?

Blender 包是开源的,并且非常受欢迎。必须有一个适合您的发行版的包,获取它的源包并剖析该包。也许需要一个发行版本地补丁,或者您可以使用它作为起点来构建您自己的最新和最好的补丁。

答案2

或者,为了避开大量这项工作,您可以在以下位置下载已构建的 Blender 版本:https://www.blender.org/download/对于Linux。

然后,从下载位置解压缩文件并将文件夹移动到usr/local

$ cd ~/Downloads
$ tar -xf blender-2.93.0-linux-x64.tar.xz
$ sudo mv blender-2.93.0-stable+blender-v293-release /usr/local

blender然后从文件夹内运行可执行文件/usr/local,运行后,右键单击该程序并选择create shortcut将来能够轻松访问搅拌机。

相关内容