I'm working on a CocoaPod that depends on two other pods i also wrote. Let's say Pod1, Pod2 and Pod3. Pod2 and Pod3 have this on their podspecs:
...
s.libraries 'sqlite3'
...
... this is because both of them use different static libraries that depend on sqlite. That line adds sqlite3 as a linked library ("Linked Frameworks and Libraries" on Build Phases) on their respective cocoapod compilation.
Then, Pod1 has both of those pods as dependencies:
...
s.dependency 'Pod2'
s.dependency 'Pod3'
...
When i try to compile Pod1, this error is thrown:
Undefined symbols for architecture x86_64:
"_sqlite3_open", referenced from:
DatabaseConnection::open() in libSecurIDLib.a(databaseconnection.o)
"_sqlite3_bind_int", referenced from:
AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_bind_double", referenced from:
AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_bind_text", referenced from:
AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_bind_blob", referenced from:
AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_column_double", referenced from:
AbstractStatement::parseRow(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_bind_null", referenced from:
AbstractStatement::bindValue(sqlite3_stmt*, DataValue const&, int) in libSecurIDLib.a(abstractstatement.o)
"_sqlite3_column_bytes", referenced from:
AbstractStatement::parseRow(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
KeyValueMapper::extractValue(boost::shared_ptr<KeyValuePair>) in libSecurIDLib.a(keyvaluemapper.o)
"_sqlite3_exec", referenced from:
CreateTableStatement::execute(DatabaseConnection*) in libSecurIDLib.a(createtablestatement.o)
EndTransactionStatement::execute(DatabaseConnection*) in libSecurIDLib.a(endtransactionstatement.o)
BeginTransactionStatement::execute(DatabaseConnection*) in libSecurIDLib.a(begintransactionstatement.o)
"_sqlite3_finalize", referenced from:
AbstractStatement::takeStepsAndFinalize(sqlite3_stmt*) in libSecurIDLib.a(abstractstatement.o)
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
TokenMapper::convertDate(CK_DATE const&) in libSecurIDLib.a(tokenmapper.o)
SqlStrings::generateInsertStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in libSecurIDLib.a(sqlstrings.o)
SqlStrings::generateCreateTableStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::shared_ptr<std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue::SQL_DATATYPE>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue::SQL_DATATYPE> > > >) in libSecurIDLib.a(sqlstrings.o)
SqlStrings::generateDeleteStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libSecurIDLib.a(sqlstrings.o)
SqlStrings::generateSelectStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libSecurIDLib.a(sqlstrings.o)
SqlStrings::generateUpdateStatement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::shared_ptr<std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, DataValue> > > >) in libSecurIDLib.a(sqlstrings.o)
"vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
typeinfo for RSA::Crypto::BSAFE_Recode in libSecurIDLib.a(BSAFE_Recode.o)
typeinfo for RSA::Crypto::BSAFE_SecretKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
typeinfo for RSA::Crypto::BSAFE_PublicKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
typeinfo for RSA::Crypto::BSAFE_PrivateKey in libSecurIDLib.a(BSAFE_CryptoKey.o)
typeinfo for RSA::Crypto::BSAFE_CryptoHash in libSecurIDLib.a(BSAFE_CryptoHash.o)
typeinfo for RSA::Crypto::BSAFE_SymmetricCipher in libSecurIDLib.a(BSAFE_SymmetricCipher.o)
some more errors that don't fit here because of the word limit, and then finishes with:
...
"_xmlSchemaCleanupTypes", referenced from:
-[yqKtL17 validateTdpUsingXsd:] in libSecurIDLib.a(TdpProcessor.o)
"___cxa_guard_release", referenced from:
SecLibMesState::instance() in libSecurIDLib.a(SecLibMesState.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What are my options? I tried to publish sqlite3 in a separate, shared pod, but it neither of both libraries take it
Make sure that the podspec specifies sqlite3 as a system library dependency:
s.library = 'sqlite3'
Related
I am getting below error while building static library uhd-types and linking with boost libraries v1.74 with memory sanitizer flag -fsanitize=memory.
[ 63%] Built target uhd-types
[ 65%] Linking CXX executable ../../bin/unit_tests
/usr/bin/ld: ../../lib/libuhd-types.a(device_addr.cpp.o): in function `boost::re_detail_107400::cpp_regex_traits_implementation<char>::lookup_collatename(char const*, char const*) const':
/root/include/boost/regex/v4/cpp_regex_traits.hpp:680: undefined reference to `boost::re_detail_107400::lookup_default_collate_name(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
/usr/bin/ld: ../../lib/libuhd-types.a(device_addr.cpp.o): in function `boost::re_detail_107400::basic_regex_parser<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::fail(boost::regex_constants::error_type, long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long)':
/root/include/boost/regex/v4/basic_regex_parser.hpp:245: undefined reference to `boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long)'
/usr/bin/ld: ../../lib/libuhd-types.a(device_addr.cpp.o): in function `boost::re_detail_107400::basic_regex_creator<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::fixup_recursions(boost::re_detail_107400::re_syntax_base*)':
/root/include/boost/regex/v4/basic_regex_creator.hpp:788: undefined reference to `boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long)'
/usr/bin/ld: /root//include/boost/regex/v4/basic_regex_creator.hpp:877: undefined reference to `boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long)'
/usr/bin/ld: ../../lib/libuhd-types.a(device_addr.cpp.o): in function `boost::re_detail_107400::basic_regex_creator<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::create_startmaps(boost::re_detail_107400::re_syntax_base*)':
/root/include/boost/regex/v4/basic_regex_creator.hpp:943: undefined reference to `boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long)'
/usr/bin/ld: ../../lib/libuhd-types.a(device_addr.cpp.o): in function `boost::re_detail_107400::basic_regex_creator<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::create_startmap(boost::re_detail_107400::re_syntax_base*, unsigned char*, unsigned int*, unsigned char)':
/root/include/boost/regex/v4/basic_regex_creator.hpp:1156: undefined reference to `boost::regex_error::regex_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, boost::regex_constants::error_type, long)'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
I already linking uhd-types to boost libraries using target_link_libraries.
I would like to play a bit with the code of MAD-X (Methodical Accelerator Design; http://madx.web.cern.ch/madx/). I must admit that I am a complete newbie to c, c++, compiling, etc.
I downloaded the sources from the Mad-X git repository (https://github.com/MethodicalAcceleratorDesign/MAD-X) to my MacBook pro (2016, Intel) and in a first step I wanted to compile the code without modifications. To do so, I run
make madx-macosx64-gnu
which runs through the compilation process with some warnings, but the linking fails with numerous errors:
*** Compiling madx_ptc_track_run.f90
*** Compiling madx_ptc_trackcavs.f90
*** Compiling ptc_export_xml.f90
*** Compiling St_pointers.f90
*** Compiling madx_ptc_twiss.f90
*** Compiling user2_photon.f90
*** Compiling madx_ptc_normal.f90
*** Compiling wrap.f90
*** Linking build/madx-macosx64-gnu
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
SeqElList::sbend_from_rbend(element const*) in mad_mkthin.o
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__push_back_slow_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_6track_name_mangler.o
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::vector(unsigned long) in mad_mkthin.o
void std::__1::vector<element*, std::__1::allocator<element*> >::__push_back_slow_path<element* const&>(element* const&) in mad_mkthin.o
void std::__1::vector<OneElementWithSlices*, std::__1::allocator<OneElementWithSlices*> >::__push_back_slow_path<OneElementWithSlices* const&>(OneElementWithSlices* const&) in mad_mkthin.o
void std::__1::vector<sequence*, std::__1::allocator<sequence*> >::__push_back_slow_path<sequence* const&>(sequence* const&) in mad_mkthin.o
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
_NameMangler_mangle in mad_6track_name_mangler.o
_NameMangler_demangle in mad_6track_name_mangler.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_6track_name_mangler.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_6track_name_mangler.o
slice_sequence(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sequence*) in mad_mkthin.o
ElementListWithSlices::find_slice(element const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_mkthin.o
SeqElList::sbend_from_rbend(element const*) in mad_mkthin.o
...
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from
[...]
can you give me advice how to compile this? E.g., there are a couple of Makefiles, one for MacOS, but I'm not sure how to use them properly.
Based on Ulrich Eckhardt's comments I ran "make -d --trace", which provides a lot of output, but unfortunately nothing more conclusive on "Undefined symbols..."
MANY LINES BEFORE
Pruning file 'Sl_family.o'.
Pruning file 'So_fitting.o'.
Pruning file 'm_real_polymorph.o'.
Pruning file 'k_tpsalie_analysis.o'.
Finished prerequisites of target file 'build/madx64'.
Must remake target 'build/madx64'.
make/linker.rules:28: update target 'build/madx64' due to: mad_elem.o mad_plot.o mad_write.o mad_dict.o mad_elemerr.o mad_str.o mad_survey.o mad_macro.o mad_option.o mad_emit.o mad_name.o mad_beam.o mad_match.o mad_cmdpar.o mad_sdds.o mad_const.o mad_array.o mad_node.o mad_cmdin.o mad_aper.o mad_vec.o mad_track.o mad_gvar.o mad_parse.o mad_ibs.o mad_time.o mad_cmd.o mad_table.o mad_twiss.o mad_main.o mad_6track.o mad_spch.o mad_ptcknobs.o mad_core.o mad_mem.o mad_sxf.o mad_util.o mad_eval.o mad_ptc.o mad_gcst.o mad_stream.o mad_exec.o mad_var.o mad_touschek.o mad_gxx11c.o mad_orbit.o mad_expr.o mad_regex.o mad_api.o mad_dynap.o mad_seq.o mad_inter.o mad_sodd.o mad_match2.o mad_select.o mad_rand.o mad_err.o mad_range.o mad_synrad.o mad_rplot.o mad_mkthin.o mad_6track_name_mangler.o touschek.o wrap.o trrun.o matchjc.o matchlib.o twiss.o madx_ptc_module.o dynap.o emit.o madx_ptc_track_run.o gxx11.o madx_ptc_script.o ibsdb.o madx_ptc_normal.o match.o orbf.o plot.o madx_ptc_trackcavs.o survey.o user2_photon.o madx_ptc_knobs.o matchlib2.o matchsa.o madx_ptc_twiss.o sodd.o madx_ptc_distrib.o util.o resindex.o madx_ptc_setcavs.o madx_ptc_eplacement.o ptc_export_xml.o madx_ptc_intstate.o mad_inif_f.o Sc_euclidean.o cc_dabnew.o b_da_arrays_all.o Spb_fake_gino_sub.o Se_status.o Sb_sagan_pol_arbitrary.o Si_def_element.o Sm_tracking.o Sd_frame.o Sf_def_all_kinds.o Sp_keywords.o Sr_spin.o cb_da_arrays_all.o Sq_orbit_ptc.o St_pointers.o Sg_sagan_wiggler.o d_lielib.o Sma0_beam_beam_ptc.o Sn_mad_like.o c_dabnew_berz.o h_definition.o Ci_tpsa.o Sh_def_kind.o a_scratch_size.o Sra_fitting.o j_tpsalie.o Sa_extend_poly.o Sma_multiparticle.o n_complex_polymorph.o Sk_link_list.o l_complex_taylor.o c_dabnew.o o_tree_element.o i_tpsa.o Sl_family.o So_fitting.o m_real_polymorph.o k_tpsalie_analysis.o
echo "*** Linking build/madx64"
Putting child 0x7f93f354ff60 (build/madx64) PID 34699 on the chain.
Live child 0x7f93f354ff60 (build/madx64) PID 34699
*** Linking build/madx64
Reaping winning child 0x7f93f354ff60 PID 34699
gfortran -m64 -O3 -fmax-stack-var-size=65536 -Wl,-no_compact_unwind -Wl,-no_pie -o build/madx64 build/Darwin64/mad_elem.o build/Darwin64/mad_plot.o build/Darwin64/mad_write.o build/Darwin64/mad_dict.o build/Darwin64/mad_elemerr.o build/Darwin64/mad_str.o build/Darwin64/mad_survey.o build/Darwin64/mad_macro.o build/Darwin64/mad_option.o build/Darwin64/mad_emit.o build/Darwin64/mad_name.o build/Darwin64/mad_beam.o build/Darwin64/mad_match.o build/Darwin64/mad_cmdpar.o build/Darwin64/mad_sdds.o build/Darwin64/mad_const.o build/Darwin64/mad_array.o build/Darwin64/mad_node.o build/Darwin64/mad_cmdin.o build/Darwin64/mad_aper.o build/Darwin64/mad_vec.o build/Darwin64/mad_track.o build/Darwin64/mad_gvar.o build/Darwin64/mad_parse.o build/Darwin64/mad_ibs.o build/Darwin64/mad_time.o build/Darwin64/mad_cmd.o build/Darwin64/mad_table.o build/Darwin64/mad_twiss.o build/Darwin64/mad_main.o build/Darwin64/mad_6track.o build/Darwin64/mad_spch.o build/Darwin64/mad_ptcknobs.o build/Darwin64/mad_core.o build/Darwin64/mad_mem.o build/Darwin64/mad_sxf.o build/Darwin64/mad_util.o build/Darwin64/mad_eval.o build/Darwin64/mad_ptc.o build/Darwin64/mad_gcst.o build/Darwin64/mad_stream.o build/Darwin64/mad_exec.o build/Darwin64/mad_var.o build/Darwin64/mad_touschek.o build/Darwin64/mad_gxx11c.o build/Darwin64/mad_orbit.o build/Darwin64/mad_expr.o build/Darwin64/mad_regex.o build/Darwin64/mad_api.o build/Darwin64/mad_dynap.o build/Darwin64/mad_seq.o build/Darwin64/mad_inter.o build/Darwin64/mad_sodd.o build/Darwin64/mad_match2.o build/Darwin64/mad_select.o build/Darwin64/mad_rand.o build/Darwin64/mad_err.o build/Darwin64/mad_range.o build/Darwin64/mad_synrad.o build/Darwin64/mad_rplot.o build/Darwin64/mad_mkthin.o build/Darwin64/mad_6track_name_mangler.o build/Darwin64/touschek.o build/Darwin64/wrap.o build/Darwin64/trrun.o build/Darwin64/matchjc.o build/Darwin64/matchlib.o build/Darwin64/twiss.o build/Darwin64/madx_ptc_module.o build/Darwin64/dynap.o build/Darwin64/emit.o build/Darwin64/madx_ptc_track_run.o build/Darwin64/gxx11.o build/Darwin64/madx_ptc_script.o build/Darwin64/ibsdb.o build/Darwin64/madx_ptc_normal.o build/Darwin64/match.o build/Darwin64/orbf.o build/Darwin64/plot.o build/Darwin64/madx_ptc_trackcavs.o build/Darwin64/survey.o build/Darwin64/user2_photon.o build/Darwin64/madx_ptc_knobs.o build/Darwin64/matchlib2.o build/Darwin64/matchsa.o build/Darwin64/madx_ptc_twiss.o build/Darwin64/sodd.o build/Darwin64/madx_ptc_distrib.o build/Darwin64/util.o build/Darwin64/resindex.o build/Darwin64/madx_ptc_setcavs.o build/Darwin64/madx_ptc_eplacement.o build/Darwin64/ptc_export_xml.o build/Darwin64/madx_ptc_intstate.o build/Darwin64/mad_inif_f.o build/Darwin64/Sc_euclidean.o build/Darwin64/cc_dabnew.o build/Darwin64/b_da_arrays_all.o build/Darwin64/Spb_fake_gino_sub.o build/Darwin64/Se_status.o build/Darwin64/Sb_sagan_pol_arbitrary.o build/Darwin64/Si_def_element.o build/Darwin64/Sm_tracking.o build/Darwin64/Sd_frame.o build/Darwin64/Sf_def_all_kinds.o build/Darwin64/Sp_keywords.o build/Darwin64/Sr_spin.o build/Darwin64/cb_da_arrays_all.o build/Darwin64/Sq_orbit_ptc.o build/Darwin64/St_pointers.o build/Darwin64/Sg_sagan_wiggler.o build/Darwin64/d_lielib.o build/Darwin64/Sma0_beam_beam_ptc.o build/Darwin64/Sn_mad_like.o build/Darwin64/c_dabnew_berz.o build/Darwin64/h_definition.o build/Darwin64/Ci_tpsa.o build/Darwin64/Sh_def_kind.o build/Darwin64/a_scratch_size.o build/Darwin64/Sra_fitting.o build/Darwin64/j_tpsalie.o build/Darwin64/Sa_extend_poly.o build/Darwin64/Sma_multiparticle.o build/Darwin64/n_complex_polymorph.o build/Darwin64/Sk_link_list.o build/Darwin64/l_complex_taylor.o build/Darwin64/c_dabnew.o build/Darwin64/o_tree_element.o build/Darwin64/i_tpsa.o build/Darwin64/Sl_family.o build/Darwin64/So_fitting.o build/Darwin64/m_real_polymorph.o build/Darwin64/k_tpsalie_analysis.o -L/usr/X11/lib -lX11 -lstdc++ -lm
Live child 0x7f93f354ff60 (build/madx64) PID 34700
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
SeqElList::sbend_from_rbend(element const*) in mad_mkthin.o
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::vector(unsigned long) in mad_mkthin.o
void std::__1::vector<element*, std::__1::allocator<element*> >::__push_back_slow_path<element* const&>(element* const&) in mad_mkthin.o
void std::__1::vector<OneElementWithSlices*, std::__1::allocator<OneElementWithSlices*> >::__push_back_slow_path<OneElementWithSlices* const&>(OneElementWithSlices* const&) in mad_mkthin.o
void std::__1::vector<sequence*, std::__1::allocator<sequence*> >::__push_back_slow_path<sequence* const&>(sequence* const&) in mad_mkthin.o
void std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::__push_back_slow_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_6track_name_mangler.o
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
slice_sequence(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, sequence*) in mad_mkthin.o
ElementListWithSlices::find_slice(element const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in mad_mkthin.o
SeqElList::sbend_from_rbend(element const*) in mad_mkthin.o
my_dump_command(command const*) in mad_mkthin.o
SeqElList::create_thick_slice(element*, int) in mad_mkthin.o
SeqElList::slice_this_node() in mad_mkthin.o
create_bend_dipedge_element(element*, bool) in mad_mkthin.o
[...]
Thanks to David Hammen's comments and the link therein:
Link OSX Homebrew Gfortran against libc++
I was able to resolve this:
I searched for all occurrences of "-lstdc++" in the files and found hits in the following files:
linker.g95 (no need to edit this...)
linker.gfortran: change line 44 from
LDLIBS += $(if $(call eq,$(OSTYPE),Darwin),-lgfortran -lstdc++ -lgcc
-lgcc_eh -lSystem -nodefaultlibs,)
to
LDLIBS += $(if $(call eq,$(OSTYPE),Darwin),-lgfortran -lc++ -lgcc
-lgcc_eh -lSystem -nodefaultlibs,)
Makefile_lib: change lines 57 and 62 (in the if-clause checking for Darwin = MACOS) and replace -lstdc++ with -lc++ too
Works like a fly :)
When I build cpp protobuf with MACOSX_DEPLOYMENT_TARGET=10.11, then I add protobuf.a and includes in my project, it works fine.
but when I try to add to project protobuf.a which built with `MACOSX_DEPLOYMENT_TARGET=10.8', it generates errors:
Undefined symbols for architecture x86_64:
"google::protobuf::MessageLite::ParseFromString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))",
"google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)"
"google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)"
"google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)", referenced from:
...
...
...
PS: My project builds with MACOSX_DEPLOYMENT_TARGET=10.8
How to build protobuf with MACOSX_DEPLOYMENT_TARGET=10.8?
I try to build C++11-project on OS X Lion (10.7.5) with clang++. All is fine, except one problem with log4cxx: after compiling I get these linker errors:
Linking CXX executable css.fcg
Undefined symbols for architecture x86_64:
"log4cxx::FileAppender::FileAppender(log4cxx::helpers::ObjectPtrT<log4cxx::Layout> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
"log4cxx::PatternLayout::PatternLayout(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
"log4cxx::Level::toLevel(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
"log4cxx::Logger::getLogger(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
"log4cxx::Logger::info(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
"log4cxx::Logger::warn(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
"log4cxx::Logger::debug(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
"log4cxx::Logger::error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
"log4cxx::Logger::fatal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
"log4cxx::Logger::trace(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
ld: symbol(s) not found for architecture x86_64
This is my clang++:
Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
I build project with flags -std=c++11 and -stdlib=libc++. Attempting to build project with Clang 3.2 didn't help.
Moreover, I've tried to install log4cxx library with port or with brew - same errors in both cases.
So what can I do?
I'm testing Boost.Python and have run into some issues.
I managed to complete the "Hello World" example without a glitch (http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/index.html) - everything compiled and I was able to use the .so properly in Python.
However, as soon as I introduced classes into my test file (http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/exposing.html), the compiler started screaming
Undefined symbols for architecture x86_64:
"boost::python::objects::function_object(boost::python::objects::py_function const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&)", referenced from:
boost::python::api::object boost::python::detail::make_function_aux<void (World::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >), boost::python::default_call_policies, boost::mpl::vector3<void, World&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, mpl_::int_<0> >(void (World::*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >), boost::python::default_call_policies const&, boost::mpl::vector3<void, World&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>) in SHLibPy.o
boost::python::api::object boost::python::detail::make_function_aux<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (World::*)(), boost::python::default_call_policies, boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, World&>, mpl_::int_<0> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > (World::*)(), boost::python::default_call_policies const&, boost::mpl::vector2<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, World&> const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>) in SHLibPy.o
boost::python::api::object boost::python::detail::make_function_aux<void (*)(_object*), boost::python::default_call_policies, boost::mpl::vector2<void, _object*>, mpl_::int_<0> >(void (*)(_object*), boost::python::default_call_policies const&, boost::mpl::vector2<void, _object*> const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&, mpl_::int_<0>) in SHLibPy.o
"boost::python::objects::register_dynamic_id_aux(boost::python::type_info, std::__1::pair<void*, boost::python::type_info> (*)(void*))", referenced from:
void boost::python::objects::register_dynamic_id<World>(World*) in SHLibPy.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems to suggest that the lib files are not linked, but I've included them in XCode
Am I missing something? Thanks very much!
I found out why. Turns out that I'm using the standard library with C++11 support. To fix the issue, I rebuilt boost using brew as follows
brew -v install --with-icu --build-from-source --with-c++11 boost