Boost, cer-çözücü gibi şeyler indirmek ve kurmak için homebrew kullanmaya çalışıyorum. Ne olur ben denemek ve herhangi bir özel bayrakları olmadan kod derleme (g++ foo.cpp -o foo -I /usr/local/...
ve ben de ++ clang denedim) olacağı ve ben sürekli bu hatayı alıyorum: ld: x86_64 mimarisi için semboller bulunamadı, clang: linker komutu başarısız oldu
Undefined symbols for architecture x86_64:
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
yüzden etrafına baktı ve çözüm kullanmaktır
-stdlib=libstdc++
bayrak. Bunu denedim ve şimdi bana elma
libstdc++
eski bir sürümü gemi ile ilgili hataları verir,
-std=c++11
veya
-std=c++14
çağırarak düzeltildi. Oldukça iyi bir yapmış ben devs umut ediyorum zorunda yoksa
/usr/local/include/ceres/internal/port.h:62:12: error: no member named
'shared_ptr' in namespace 'std'
using std::shared_ptr;
~~~~~^
...
/usr/local/include/ceres/solver.h:629:15: error: expected member name or ';'
after declaration specifiers
shared_ptr<ParameterBlockOrdering> inner_iteration_ordering;
~~~~~~~~~~^
5 errors generated.
Doğrusu kütüphane kaynak kodunu düzenleyemezsiniz ediyorum: Bu shared_ptr gibi C++ 11 sözdizimine itirazları kusar iş?
Doğru bağlamayı sağlayacak kütüphaneleri (homebrew ile veya olmadan) oluşturmanın bir yolu var mı? Şu anda sadece brew install <package>
açık bir şey eksik miyim? Yoksa kodu kendim derlediğimde bir şey mi batıyorum?
Mac OS X 10.10.5 çıkıyorum ve demlemek --config bu verir:
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 03ad27453de01adc29cbf941bd29a2dfb54a9960
Last commit: 69 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: 8-core 64-bit ivybridge
OS X: 10.10.5-x86_64
Xcode: 6.4
CLT: 6.4.0.0.1.1435007323
Clang: 6.1 build 602
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby
Java: N/A
$arch
Running verir: i386
ve $clang++ -v
verir:
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
Eski bir sürümün veya bir şeylerin ayıklanması durumunda bilgisayarımı temizlemeyi denediğimi eklemeliyim. Gördüğüm her şey, bu hatanın yapım zamanında uygunsuz bir bağlantıdan kaynaklandığını söylüyor, ama demlemek en azından, en azından söyleyebileceğim kadarıyla düzgün bir şekilde yapıyor gibi görünüyor mu? Her şey iyi kurulur ve inşa edilir. 5 ve ben derleme zamanında -std=c++11
bayrağı geçirmeye çalıştıklarında gcc-5 komut clang önlemek ve aynı sorun olsun - - g++-5 foo.cpp -o foo -I /usr/local/bar -std=c++11
Ben demlemek kullanarak gcc yüklenmiş ve ettik g ++ kullanarak kütüphane derlemeye çalıştık . Bu çalışmaların hiçbiri.
Ayrıca bunların, örneğin, kendi komut dosyamlarım bile desteklemeyen örnek komut dosyalarını derlemeye ve çalıştırmaya çalıştığımda bunların olmasını vurgulamalıyım. Sadece kütüphanelerin en azından çoğunlukla doğru olduğunu umuyorum.
Aynı zamanda birçok benzer soruya da baktım, birçoğu cevapsız ve çözümleri olanları da, pek çok çözümü denedim ve onlara da yardım etmediler. -lstdc++.6
denedim, denedim -stdlib=libstdc++
. -l hiçbir şey değiştirmez, -stdlib
yukarıda anlattığım sorunlara neden olur.
Elde edebileceğim herhangi bir yardım harika olurdu, haftalardır bunun üzerinde çalışıyorum ve beni delirtiyor.netlik için
Hızlı Düzenleme:
Peki ne zaman girdi:
$g++ cerestest.cpp -o ceres -I /usr/local/include/eigen3
veya
$clang++ cerestest.cpp -o ceres -I /usr/local/include/eigen3
alıyorum:
Undefined symbols for architecture x86_64:
"ceres::Solve(ceres::Solver::Options const&, ceres::Problem*, ceres::Solver::Summary*)", referenced from:
_main in cerestest-ef733e.o
"ceres::Solver::Summary::Summary()", referenced from:
_main in cerestest-ef733e.o
"ceres::Problem::AddResidualBlock(ceres::CostFunction*, ceres::LossFunction*, double*)", referenced from:
_main in cerestest-ef733e.o
"ceres::Problem::Problem()", referenced from:
_main in cerestest-ef733e.o
"ceres::Problem::~Problem()", referenced from:
_main in cerestest-ef733e.o
"google::LogMessage::stream()", referenced from:
ceres::AutoDiffCostFunction<CostFunctor, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::AutoDiffCostFunction(CostFunctor*) in cerestest-ef733e.o
ceres::internal::AutoDiff<CostFunctor, double, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::Differentiate(CostFunctor const&, double const* const*, int, double*, double**) in cerestest-ef733e.o
void ceres::internal::Make1stOrderPerturbation<ceres::Jet<double, 1>, double, 1>(int, double const*, ceres::Jet<double, 1>*) in cerestest-ef733e.o
void ceres::internal::Take0thOrderPart<ceres::Jet<double, 1>, double*>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
void ceres::internal::Take1stOrderPart<ceres::Jet<double, 1>, double, 0, 1>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
"google::LogMessageFatal::LogMessageFatal(char const*, int)", referenced from:
void ceres::internal::Make1stOrderPerturbation<ceres::Jet<double, 1>, double, 1>(int, double const*, ceres::Jet<double, 1>*) in cerestest-ef733e.o
void ceres::internal::Take0thOrderPart<ceres::Jet<double, 1>, double*>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
void ceres::internal::Take1stOrderPart<ceres::Jet<double, 1>, double, 0, 1>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
"google::LogMessageFatal::LogMessageFatal(char const*, int, google::CheckOpString const&)", referenced from:
ceres::AutoDiffCostFunction<CostFunctor, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::AutoDiffCostFunction(CostFunctor*) in cerestest-ef733e.o
ceres::internal::AutoDiff<CostFunctor, double, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::Differentiate(CostFunctor const&, double const* const*, int, double*, double**) in cerestest-ef733e.o
"google::LogMessageFatal::~LogMessageFatal()", referenced from:
ceres::AutoDiffCostFunction<CostFunctor, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::AutoDiffCostFunction(CostFunctor*) in cerestest-ef733e.o
ceres::internal::AutoDiff<CostFunctor, double, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0>::Differentiate(CostFunctor const&, double const* const*, int, double*, double**) in cerestest-ef733e.o
void ceres::internal::Make1stOrderPerturbation<ceres::Jet<double, 1>, double, 1>(int, double const*, ceres::Jet<double, 1>*) in cerestest-ef733e.o
void ceres::internal::Take0thOrderPart<ceres::Jet<double, 1>, double*>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
void ceres::internal::Take1stOrderPart<ceres::Jet<double, 1>, double, 0, 1>(int, ceres::Jet<double, 1> const*, double*) in cerestest-ef733e.o
"google::InitGoogleLogging(char const*)", referenced from:
_main in cerestest-ef733e.o
"google::base::CheckOpMessageBuilder::ForVar2()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*) in cerestest-ef733e.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, ceres::DimensionType>(int const&, ceres::DimensionType const&, char const*) in cerestest-ef733e.o
"google::base::CheckOpMessageBuilder::NewString()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*) in cerestest-ef733e.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, ceres::DimensionType>(int const&, ceres::DimensionType const&, char const*) in cerestest-ef733e.o
"google::base::CheckOpMessageBuilder::CheckOpMessageBuilder(char const*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*) in cerestest-ef733e.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, ceres::DimensionType>(int const&, ceres::DimensionType const&, char const*) in cerestest-ef733e.o
"google::base::CheckOpMessageBuilder::~CheckOpMessageBuilder()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, int>(int const&, int const&, char const*) in cerestest-ef733e.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* google::MakeCheckOpString<int, ceres::DimensionType>(int const&, ceres::DimensionType const&, char const*) in cerestest-ef733e.o
"ceres::Solver::Summary::BriefReport() const", referenced from:
_main in cerestest-ef733e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ve bu sadece Ceres değil, ars als için benzer hatalar meydana gelir O. Mark Setchell için
LibC++ değil libstdC++ kullanın. Gerçekte eksik sembol mesajlarını gösterirseniz neler olduğunu görmek daha kolay olacaktır :) IIRC libstdC++ kütüphanenin eski bir GNU sürümüdür. libC++ şimdi çoğu şey için çalışmalı. Ve belki de problemi üretmek için kesin adımları gösteriyor musunuz? – JCx
Yukarıda eklendi, teşekkürler :) libstdC++ kullanmanın tek nedeni, aslında bana farklı bir hata verdi, çünkü neyin yanlış olduğunu bulmak için yararlı olabileceğini düşündüm. – bzcheeseman
, 'g ++' ve 'hangi clang ++' türlerini yazmayı deneyin. Yollarınızın berbat olduğu ve sizin düşündüğünüz programları yürütmediğiniz muhtemeldir. Tam olarak hangi ikili çalışmayı belirtmek isterseniz, .h/'sözdizimini bash içinde kullanabilir ve ikili yolun tam yolunu belirtebilirsiniz –