Opened 2 years ago

Closed 15 months ago

#66378 closed defect (worksforme)

llvm-13 +universal build fails due to architecture of /opt/local/lib/libstdc++.6.dylib

Reported by: barracuda156 Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version: 2.8.0
Keywords: mountainlion Cc:
Port: llvm-13

Description

:info:build [ 92%] Linking CXX shared module ../../LLVMHello.dylib
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/lib/Transforms/Hello && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/LLVMHello.dir/link.txt --verbose=ON
:info:build /opt/local/bin/clang++-mp-11 -pipe -Os -DNDEBUG -D__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__=1 -D__DISABLE_MP_LEGACY_SUPPORT_REALPATH_WRAP__=1 -isystem/opt/local/include/LegacySupport -I/opt/local/include -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -O3 -DNDEBUG -arch x86_64 -arch i386 -mmacosx-version-min=10.8 -bundle -Wl,-headerpad_max_install_names  -Wl,-dead_strip -Wl,-exported_symbols_list,"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/lib/Transforms/Hello/LLVMHello.exports" -L/opt/local/lib -Wl,-headerpad_max_install_names /opt/local/lib/libMacportsLegacySupport.a -Wl,-flat_namespace -Wl,-undefined -Wl,suppress -o ../../LLVMHello.dylib CMakeFiles/LLVMHello.dir/Hello.cpp.o  -Wl,-rpath,@loader_path/../lib ../../libLLVM.dylib 
:info:build ld: in '/opt/local/lib/libstdc++.6.dylib', file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libstdc++.6.dylib for architecture i386
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [lib/LLVMHello.dylib] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build make[1]: *** [lib/Transforms/Hello/CMakeFiles/LLVMHello.dir/all] Error 2
:info:build make[1]: *** Waiting for unfinished jobs....
:info:build [ 92%] Linking CXX executable ../../bin/llvm-config
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/tools/llvm-config && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/llvm-config.dir/link.txt --verbose=ON
:info:build /opt/local/bin/clang++-mp-11 -pipe -Os -DNDEBUG -D__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__=1 -D__DISABLE_MP_LEGACY_SUPPORT_REALPATH_WRAP__=1 -isystem/opt/local/include/LegacySupport -I/opt/local/include -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -O3 -DNDEBUG -arch x86_64 -arch i386 -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names /opt/local/lib/libMacportsLegacySupport.a  -Wl,-dead_strip "CMakeFiles/llvm-config.dir/llvm-config.cpp.o" -o ../../bin/llvm-config  -Wl,-rpath,@loader_path/../lib ../../lib/libLLVM.dylib 
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build [ 92%] Built target llvm-config
:info:build [ 92%] Linking CXX executable ../../bin/llvm-ar
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/tools/llvm-ar && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/llvm-ar.dir/link.txt --verbose=ON
:info:build /opt/local/bin/clang++-mp-11 -pipe -Os -DNDEBUG -D__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__=1 -D__DISABLE_MP_LEGACY_SUPPORT_REALPATH_WRAP__=1 -isystem/opt/local/include/LegacySupport -I/opt/local/include -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -O3 -DNDEBUG -arch x86_64 -arch i386 -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names /opt/local/lib/libMacportsLegacySupport.a  -Wl,-dead_strip "CMakeFiles/llvm-ar.dir/llvm-ar.cpp.o" -o ../../bin/llvm-ar  -Wl,-rpath,@loader_path/../lib ../../lib/libLLVM.dylib 
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build [ 92%] Built target llvm-ar
:info:build [ 92%] Linking CXX shared library ../../lib/libLTO.dylib
:info:build cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/tools/lto && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/LTO.dir/link.txt --verbose=ON
:info:build /opt/local/bin/clang++-mp-11 -pipe -Os -DNDEBUG -D__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__=1 -D__DISABLE_MP_LEGACY_SUPPORT_REALPATH_WRAP__=1 -isystem/opt/local/include/LegacySupport -I/opt/local/include -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -O3 -DNDEBUG -arch x86_64 -arch i386 -mmacosx-version-min=10.8 -dynamiclib -Wl,-headerpad_max_install_names  -Wl,-dead_strip -Wl,-exported_symbols_list,"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build/tools/lto/LTO.exports" -compatibility_version 1 -current_version 13.0.1 -L/opt/local/lib -Wl,-headerpad_max_install_names /opt/local/lib/libMacportsLegacySupport.a -o ../../lib/libLTO.dylib -install_name @rpath/libLTO.dylib CMakeFiles/LTO.dir/LTODisassembler.cpp.o CMakeFiles/LTO.dir/lto.cpp.o  -Wl,-rpath,@loader_path/../lib ../../lib/libLLVM.dylib 
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build [ 92%] Built target LTO
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_llvm-13/llvm-13/work/build" && /usr/bin/make -j4 -w all VERBOSE=ON 
:info:build Exit code: 2
:error:build Failed to build llvm-13: command execution failed
:debug:build Error code: CHILDSTATUS 2667 2

Attachments (1)

llvm13.log (6.5 MB) - added by barracuda156 2 years ago.

Change History (10)

Changed 2 years ago by barracuda156

Attachment: llvm13.log added

comment:1 Changed 2 years ago by kencu (Ken)

So the proximate cause is that /opt/local/lib/libstdc++.6.dylib needs to be universal, and it is not universal, so the link fails.

However, the real cause is less clear, as that file /opt/local/lib/libstdc++.6.dylib should not be called in to link code when -stdlib=libc++, which it appears to be.

So where is that coming from? Are you using absolutely stock toolchains here, or are you using some alternative toolchain like the one from Iain's repo we recently added for testing with? I could imagine that some part of libtapi or ld64-something might be possibly calling in /opt/local/lib/libstdc++.6.dylib...

comment:2 in reply to:  1 Changed 2 years ago by barracuda156

Replying to kencu:

So the proximate cause is that /opt/local/lib/libstdc++.6.dylib needs to be universal, and it is not universal, so the link fails.

However, the real cause is less clear, as that file /opt/local/lib/libstdc++.6.dylib should not be called in to link code when -stdlib=libc++, which it appears to be.

So where is that coming from? Are you using absolutely stock toolchains here, or are you using some alternative toolchain like the one from Iain's repo we recently added for testing with? I could imagine that some part of libtapi or ld64-something might be possibly calling in /opt/local/lib/libstdc++.6.dylib...

On 10.8.5 everything is stock. And no darwin-xtools are not being used (not even installed there).

comment:3 Changed 2 years ago by kencu (Ken)

OK, then install libgcc as universal and see if it works then. If it does, that proves the point.

Then to figure out why it is being called at all. At the moment, I cannot see why it would be. There are 100,000 possible factors, which is why we insist on having one supported system variation if people want help with tickets.

If it was me, I might try deactivating libgccN and see if any of the toolchain components complain.

comment:4 in reply to:  3 Changed 2 years ago by barracuda156

Replying to kencu:

OK, then install libgcc as universal and see if it works then. If it does, that proves the point.

Took forever to build it as universal, but you are absolutely right: once I installed libgcc12 and libgcc as universal, llvm-13 +universal installed fine. I just resumed the build, and it went through completion.

10:~ svacchanda$ port -v installed libgcc12
The following ports are currently installed:
  libgcc12 @12.2.0_0+stdlib_flag requested_variants='' platform='darwin 12' archs='x86_64' date='2022-10-21T13:53:56+0800'
  libgcc12 @12.2.0_2+stdlib_flag+universal (active) requested_variants='+universal' platform='darwin 12' archs='i386 x86_64' date='2022-12-01T05:05:43+0800'
10:~ svacchanda$ port -v installed llvm-13
The following ports are currently installed:
  llvm-13 @13.0.1_2+universal (active) requested_variants='+universal' platform='darwin 12' archs='i386 x86_64' date='2022-12-01T06:55:59+0800'
Last edited 2 years ago by barracuda156 (previous) (diff)

comment:5 Changed 2 years ago by kencu (Ken)

still no idea why, though.

"If it was me, I might try deactivating libgccN and see if any of the toolchain components complain."

comment:6 in reply to:  5 ; Changed 2 years ago by barracuda156

Replying to kencu:

still no idea why, though.

"If it was me, I might try deactivating libgccN and see if any of the toolchain components complain."

Not today though. It is another multi-hour endeavor.

comment:7 Changed 2 years ago by kencu (Ken)

Summary: llvm-13 fails to build as +universal on 10.8.5llvm-13 +universal build fails due to architecture of /opt/local/lib/libstdc++.6.dylib

comment:8 in reply to:  6 Changed 2 years ago by kencu (Ken)

Replying to barracuda156:

Not today though. It is another multi-hour endeavor.

actually, 10 seconds is all it takes, no multi-hour endeavours needed:

sudo port -v deactivate libgcc

see if any toolchain parts are listed as going to be broken by this.

Then after you see that, say "N" and everything stays like it was.

eg:

$ sudo port -v deactivate libgcc
Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents.
The following ports will break:
 fftw-3 @3.3.10_0
 OpenBLAS @0.3.21_1
 py310-numpy @1.23.5_0
 ecCodes @2.27.1_0
Continue? [y/N]: N
Last edited 23 months ago by kencu (Ken) (previous) (diff)

comment:9 Changed 15 months ago by kencu (Ken)

Resolution: worksforme
Status: assignedclosed

whatever was going on here is not a general problem

Note: See TracTickets for help on using tickets.