Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failure on Apple MacBook Pro M1 Max #270

Closed
zx5337 opened this issue Jul 11, 2023 · 6 comments
Closed

Build Failure on Apple MacBook Pro M1 Max #270

zx5337 opened this issue Jul 11, 2023 · 6 comments

Comments

@zx5337
Copy link

zx5337 commented Jul 11, 2023

What version of osmium-tool are you using?

osmium-3.6.0-cp311-cp311-macosx_13_0_universal2.whl

make
[ 1%] Linking CXX executable osmium
ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib, file is universal (i386,x86_64) but does not contain the arm64 architecture: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib
Undefined symbols for architecture arm64:
"_XML_ErrorString", referenced from:
osmium::xml_error::xml_error(XML_ParserStruct* const&) in io.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in osm_file_parser.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_export.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_extract.cpp.o
"_XML_GetCurrentColumnNumber", referenced from:
osmium::xml_error::xml_error(XML_ParserStruct* const&) in io.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in osm_file_parser.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_export.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_extract.cpp.o
"_XML_GetCurrentLineNumber", referenced from:
osmium::xml_error::xml_error(XML_ParserStruct* const&) in io.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in osm_file_parser.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_export.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_extract.cpp.o
"_XML_GetErrorCode", referenced from:
osmium::xml_error::xml_error(XML_ParserStruct* const&) in io.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in osm_file_parser.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_export.cpp.o
osmium::xml_error::xml_error(XML_ParserStruct* const&) in command_extract.cpp.o
"_XML_Parse", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, bool) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, bool) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, bool) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, bool) in command_extract.cpp.o
"_XML_ParserCreate", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_extract.cpp.o
"_XML_ParserFree", referenced from:
osmium::io::detail::XMLParser::run() in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::~ExpatXMLParser() in io.cpp.o
osmium::io::detail::XMLParser::run() in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::~ExpatXMLParser() in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::run() in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::~ExpatXMLParser() in command_export.cpp.o
osmium::io::detail::XMLParser::run() in command_extract.cpp.o
...
"_XML_SetCharacterDataHandler", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_extract.cpp.o
"_XML_SetElementHandler", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_extract.cpp.o
"_XML_SetEntityDeclHandler", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_extract.cpp.o
"_XML_SetUserData", referenced from:
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in io.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in osm_file_parser.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_export.cpp.o
osmium::io::detail::XMLParser::ExpatXMLParser::ExpatXMLParser(void*) in command_extract.cpp.o
"_XML_StopParser", referenced from:
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::start_element_wrapper(void*, char const*, char const**)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::start_element_wrapper(void*, char const*, char const**)::'lambda'(osmium::io::detail::XMLParser&)&&) in io.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::end_element_wrapper(void*, char const*)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::end_element_wrapper(void*, char const*)::'lambda'(osmium::io::detail::XMLParser&)&&) in io.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::character_data_wrapper(void*, char const*, int)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::character_data_wrapper(void*, char const*, int)::'lambda'(osmium::io::detail::XMLParser&)&&) in io.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::entity_declaration_handler(void*, char const*, int, char const*, int, char const*, char const*, char const*, char const*)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::entity_declaration_handler(void*, char const*, int, char const*, int, char const*, char const*, char const*, char const*)::'lambda'(osmium::io::detail::XMLParser&)&&) in io.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::start_element_wrapper(void*, char const*, char const**)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::start_element_wrapper(void*, char const*, char const**)::'lambda'(osmium::io::detail::XMLParser&)&&) in osm_file_parser.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::end_element_wrapper(void*, char const*)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::end_element_wrapper(void*, char const*)::'lambda'(osmium::io::detail::XMLParser&)&&) in osm_file_parser.cpp.o
void osmium::io::detail::XMLParser::ExpatXMLParser::member_wrap<osmium::io::detail::XMLParser::ExpatXMLParser::character_data_wrapper(void*, char const*, int)::'lambda'(osmium::io::detail::XMLParser&)>(osmium::io::detail::XMLParser&, osmium::io::detail::XMLParser::ExpatXMLParser::character_data_wrapper(void*, char const*, int)::'lambda'(osmium::io::detail::XMLParser&)&&) in osm_file_parser.cpp.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/osmium] Error 1
make[1]: *** [src/CMakeFiles/osmium.dir/all] Error 2
make: *** [all] Error 2

What operating system version are you using?

MacOS Ventura 13.4.1

Tell us something about your system

This is a MacBook Pro M1 Max

What did you do exactly?

I followed the instruction in README.txt to make the tool

What did you expect to happen?

Make Pass, No error when import to a python program.

What did happen instead?

Make failure

When import the python library, by use a "pip3 install osmium". Python raise a similar failure:
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/osmium/init.py", line 8, in
from osmium._osmium import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/osmium/_osmium.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_XML_ErrorString'

What did you do to try analyzing the problem?

Try to reinstall the libxml2. and Mono framework. It dose not work.
I find another Intel X86 machine on the Same version of MacOS. It did work properly. So, I assume this tool is lack support on Apple M1 on Most Recent Ventura 13.4.1 MacOS

@joto
Copy link
Member

joto commented Jul 11, 2023

Osmium doesn't use libxml2 but expat. Try installing that.

@zx5337
Copy link
Author

zx5337 commented Jul 11, 2023

Osmium doesn't use libxml2 but expat. Try installing that.

done this "brew install expat", still not working for both make and import osmium. Anyway I can let osmium to use the installed version of libexpat.?

@joto
Copy link
Member

joto commented Jul 11, 2023

Ah, it says right at the top of the messages you are quoting: "ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib, file is universal (i386,x86_64) but does not contain the arm64 architecture:" So apparently the expat lib doesn't work in ARM. I suggest you open an issue in Homebrew.

@zx5337
Copy link
Author

zx5337 commented Jul 11, 2023

Ah, it says right at the top of the messages you are quoting: "ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib, file is universal (i386,x86_64) but does not contain the arm64 architecture:" So apparently the expat lib doesn't work in ARM. I suggest you open an issue in Homebrew.

I think I know the problem. Two issues: 1 pip3 install is not working for the most recent version 3.6.0. I uninstall it and install with "pip install osmium==3.4.0". Now, the python framework works. 2 the build, it seem the libexpat that found by cmake was not the right version. It should use Xcode 14.3.0, instead the Mono one. I clean the build folder, re-genrated the makefile. This time it found the libexpat in Xcode. Now, the build has passed. Need someone to update the osmium 3.6.0 library to build a proper universal version.

@joto
Copy link
Member

joto commented Jul 12, 2023

Okay, so I understand Osmium tool now works for you. For the issue with Pyosmium see osmcode/pyosmium#227. Closing here.

@joto joto closed this as completed Jul 12, 2023
@0xFA11
Copy link

0xFA11 commented Sep 1, 2023

FWIW, I'm getting the exact same linker error in Xcode on an M1 Max machine:
(I generated projects with cmake -G Xcode)

ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib, file is universal (i386,x86_64) but does not contain the arm64 architecture: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/libexpat.dylib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants