[MacPorts] #69480: llvm-17 fails to build agains port:legacy-support=1.1.1 when the latter is build with -flto

MacPorts noreply at macports.org
Mon Mar 11 20:21:39 UTC 2024


#69480: llvm-17 fails to build agains port:legacy-support=1.1.1 when the latter is
build with -flto
--------------------+----------------------------
 Reporter:  RJVB    |      Owner:  (none)
     Type:  defect  |     Status:  new
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:  legacy-support
--------------------+----------------------------
 Mostly a FYI:

 Trying to build llvm-17 fails after upgrading my port:legacy-support from
 1.0.9 to 1.1.1, still built with `-flto` in `configure.optflags` for
 optimal performance and clang-12 .

 {{{
 :info:build ninja: job failed: : && /opt/local/bin/clang++-mp-16 -Os
 -march=native -fvectorize -DNDEBUG
 -D__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__=1
 -D__DISABLE_MP_LEGACY_SUPPORT_REALPATH_WRAP__=1
 -isystem/opt/local/include/LegacySupport -isystem/opt/local/include
 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -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 -Wctad-maybe-unsupported
 -fdiagnostics-color -arch x86_64 -mmacosx-version-min=10.9
 -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
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/Attributes.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/CodeGenIntrinsics.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/DirectiveEmitter.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/IntrinsicEmitter.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/RISCVTargetDefEmitter.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/SDNodeProperties.cpp.o
 utils/TableGen/CMakeFiles/obj.LLVMTableGenCommon.dir/VTEmitter.cpp.o
 utils/TableGen/CMakeFiles/llvm-min-tblgen.dir/TableGen.cpp.o -o bin/llvm-
 min-tblgen  -Wl,-rpath,/opt/local/lib
 -Wl,-rpath,/opt/local/libexec/lld-17/lib  lib/libLLVMSupport.a
 lib/libLLVMTableGen.a  lib/libLLVMSupport.a  -lm
 /opt/local/lib/libz.dylib  /opt/local/lib/libzstd.dylib
 /opt/local/lib/libcurses.dylib  lib/libLLVMDemangle.a && :
 :info:build Undefined symbols for architecture x86_64:
 :info:build   "___mpls_closedir", referenced from:
 :info:build
 llvm::sys::fs::detail::directory_iterator_destruct(llvm::sys::fs::detail::DirIterState&)
 in libLLVMSupport.a(Path.cpp.o)
 :info:build   "___mpls_readdir", referenced from:
 :info:build
 llvm::sys::fs::detail::directory_iterator_increment(llvm::sys::fs::detail::DirIterState&)
 in libLLVMSupport.a(Path.cpp.o)
 :info:build   "___mpls_opendir", referenced from:
 :info:build
 llvm::sys::fs::detail::directory_iterator_construct(llvm::sys::fs::detail::DirIterState&,
 llvm::StringRef, bool) in libLLVMSupport.a(Path.cpp.o)
 :info:build ld: symbol(s) not found for architecture x86_64
 }}}

 For some reason `-flto` does not have this effect on the shared library
 (tested by replacing the .a archive above with the corresponding .dylib).

 I've been able to work around the issue by adding this to the legacy-
 support Portfile:
 {{{
 # build static library without LTO
 build.post_args-append \
                     SLIBCFLAGS=-fno-lto
 }}}

 but I suspect that a better solution should be possible (generate the
 static library from the same sources as the dylib, as so many projects
 do?).

-- 
Ticket URL: <https://trac.macports.org/ticket/69480>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list