You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple M1 processors are failing to link the iConv library distributed in macOS SDK 11.3. The full message is:
[ 47%] Building CXX object src/CMakeFiles/exiv2lib.dir/bmffimage.cpp.o
[ 48%] Linking CXX shared library ../lib/libexiv2.dylib
Undefined symbols for architecture arm64:
"_libiconv", referenced from:
(anonymous namespace)::convertStringCharsetIconv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char const*, char const*) in convert.cpp.o
"_libiconv_close", referenced from:
(anonymous namespace)::convertStringCharsetIconv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char const*, char const*) in convert.cpp.o
"_libiconv_open", referenced from:
(anonymous namespace)::convertStringCharsetIconv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char const*, char const*) in convert.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]: *** [lib/libexiv2.0.27.5.2.dylib] Error 1
make[1]: *** [src/CMakeFiles/exiv2lib.dir/all] Error 2
make: *** [all] Error 2
565 rmills@rmillsm1:~/gnu/github/exiv2/foo/0.27-maintenance/build $
The work-around is:
diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake
index ec3a43f5..625f825a 100644
--- a/cmake/findDependencies.cmake+++ b/cmake/findDependencies.cmake@@ -53,6 +53,15 @@ if (EXIV2_ENABLE_NLS)
endif( )
find_package(Iconv)
+# Don't use Iconv on macOS M1. Linker fails because SDK libiconv not been built for arm64+if ( APPLE )+ EXECUTE_PROCESS( COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE )+ if ( ${ARCHITECTURE} STREQUAL arm64 )+ set(ICONV_FOUND 0)+ message ( "-- ICONV ignored on Apple M1 processor" )+ endif()+endif()+
if( ICONV_FOUND )
message ( "-- ICONV_INCLUDE_DIR : " ${Iconv_INCLUDE_DIR} )
message ( "-- ICONV_LIBRARIES : " ${Iconv_LIBRARY} )
When this patch is applied, the outputfrom cmake is:
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found Iconv: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libiconv.tbd
-- ICONV ignored on Apple M1 processor
I don't think this code should be added permanently as it would disable libiconv permanently on the M1. Presumably Apple will fix the SDK. I haven't reported this to Apple. So let's leave this issue open and "never fix" as the issue should disappear in time.
The text was updated successfully, but these errors were encountered:
Apple M1 processors are failing to link the iConv library distributed in macOS SDK 11.3. The full message is:
The work-around is:
When this patch is applied, the outputfrom cmake is:
I don't think this code should be added permanently as it would disable libiconv permanently on the M1. Presumably Apple will fix the SDK. I haven't reported this to Apple. So let's leave this issue open and "never fix" as the issue should disappear in time.
The text was updated successfully, but these errors were encountered: