मैं होमब्री को बूस्ट, सीरीज-सॉल्वर, जैसे सामान डाउनलोड और बनाने के लिए उपयोग करने का प्रयास कर रहा हूं। क्या होता है कि मैं कोशिश करूँगा और कोड संकलन, किसी विशेष झंडे के बिना (g++ foo.cpp -o foo -I /usr/local/...
और मैं भी बजना की कोशिश की है ++) है और मैं इस त्रुटि लगातार मिलती है:ld: आर्किटेक्चर x86_64 के लिए प्रतीकों को नहीं मिला है, क्लैंग: लिंकर कमांड
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)
तो मैं चारों ओर देखा और समाधान का उपयोग करने के लिए है -stdlib=libstdc++
ध्वज। मैंने कोशिश की, और अब यह मुझे इस तथ्य से संबंधित त्रुटियां देता है कि सेब libstdc++
का पुराना संस्करण भेजता है, -std=c++11
या -std=c++14
का आह्वान करके तय नहीं किया जाता है। यह सी ++ 11 वाक्य रचना shared_ptr तरह से आपत्तियों को ऊपर फेंकता है:
/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.
मैं नहीं बल्कि पुस्तकालय स्रोत कोड को संपादित नहीं करता है, तो मैं, मैं devs आशा करता हूँ की जरूरत नहीं है चाहता हूँ एक बहुत अच्छा किया है काम?
पुस्तकालयों (होमब्री के साथ या बिना) बनाने का कोई तरीका है जो सही लिंकिंग देगा? वर्तमान में मैं बस brew install <package>
हूँ क्या मुझे कुछ याद आ रही है? या जब मैं कोड को संकलित करता हूं तो क्या मैं कुछ खराब कर रहा हूं?
मैं पर मैक ओएस एक्स 10.10.5 हूँ, और काढ़ा --config इस देता है:
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
चल देता है: i386
और $clang++ -v
देता है:
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
मुझे यह जोड़ना चाहिए कि मैंने पुराने कंप्यूटर या कुछ चीजों को चकित करने के मामले में अपने कंप्यूटर को साफ करने की कोशिश की है। मैंने जो कुछ भी देखा है, वह कहता है कि यह त्रुटि निर्माण समय पर अनुचित लिंकिंग के कारण होती है, लेकिन ऐसा लगता है कि ब्रूव उसमें से अधिकतर सही तरीके से करता है, कम से कम जहां तक मैं कह सकता हूं? सब ठीक है और ठीक बनाता है। 5 और जीसीसी -5 आदेश बजना से बचने के लिए और मैं एक ही समस्या मिलती है, जब मैं संकलन समय पर -std=c++11
ध्वज पारित करने के लिए कोशिश - - g++-5 foo.cpp -o foo -I /usr/local/bar -std=c++11
मैं काढ़ा का उपयोग कर जीसीसी स्थापित किया है और किया है जी ++ का उपयोग करते हुए पुस्तकालय संकलन करने की कोशिश की । इनमें से कोई भी काम नहीं।
मुझे यह भी ज़ोर देना चाहिए कि जब मैं उदाहरण स्क्रिप्ट्स को संकलित और चलाने की कोशिश करता हूं, उदाहरण के लिए, अपनी खुद की स्क्रिप्ट्स को भी बढ़ावा नहीं देता है। मैं उम्मीद कर रहा हूं कि पुस्तकालय कम से कम सही हैं।
मैंने यहां बहुत सारे प्रश्न भी देखे हैं, कई अनुत्तरित हैं और जिनके पास समाधान हैं, ठीक है, मैंने कई समाधानों की कोशिश की है और वे या तो मदद नहीं करते हैं। मैंने -lstdc++.6
की कोशिश की है, मैंने -stdlib=libstdc++
को आजमाया है। -एल कुछ भी नहीं बदलता है, -stdlib
ऊपर बताए गए मुद्दों का कारण बनता है।
कोई भी मदद जो मैं प्राप्त कर सकता हूं वह बहुत अच्छा होगा, मैं इस पर काम कर रहा हूं और यह मुझे पागल कर रहा है।
स्पष्टता के लिए त्वरित संपादन:
तो जब मैं इनपुट:
$g++ cerestest.cpp -o ceres -I /usr/local/include/eigen3
या
$clang++ cerestest.cpp -o ceres -I /usr/local/include/eigen3
मैं:
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)
और यह सिर्फ सायरस नहीं है, बूस्ट एल्स के लिए समान त्रुटियां होती हैं ओ।
libC++ का प्रयोग libstdC++ नहीं करें। यदि आप वास्तविक लापता प्रतीक संदेश दिखाते हैं तो यह देखना आसान होगा कि क्या हो रहा है :) IIRC libstdC++ लाइब्रेरी का एक पुराना जीएनयू संस्करण है। libC++ अब अधिकांश सामानों के लिए काम करना चाहिए। और शायद समस्या का उत्पादन करने के लिए सही कदम दिखा सकते हैं? – JCx
ऊपर जोड़ा गया, धन्यवाद :) libstdC++ का उपयोग करने का एकमात्र कारण यह है कि यह वास्तव में मुझे एक अलग त्रुटि देता है, मैंने सोचा कि यह गलत है कि यह पता लगाने में सहायक हो सकता है। – bzcheeseman
'कौन सा g ++' और 'कौन सा clang ++' टाइप करने का प्रयास करें। ऐसा लगता है कि आपके पथ गड़बड़ हो गए हैं और आप वास्तव में उन कार्यक्रमों को नहीं चला रहे हैं जो आप सोचते हैं। यदि आप वास्तव में निर्दिष्ट करना चाहते हैं कि बाइनरी को चलाने के लिए, आप बैश में '। /' वाक्यविन्यास का उपयोग कर सकते हैं और बाइनरी –