Skip to content

We seem to link against wrong libstdc++ when building on mingw #57021

Open
@Zentrik

Description

@Zentrik

On llvm master (since llvm/llvm-project@52c338d) libLLVMSupport.a now depends on the _ZSt14__once_functor symbol. These are not provided by the system libstdc++ on mingw64 but they are by the libstdc++ we use on BinaryBuilder (due to JuliaPackaging/Yggdrasil#5761).

When linking libjulia-internal we don't link against the BinaryBuilder libstdc++ which is stored in usr/bin/libstdc++-6.dll causing the link to fail. I think we should be linking against it.

 g++ -m64 -shared   -Wl,--out-implib,/d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libjulia-internal.dll.a -pipe  -fno-rtti -std=c++17 -Wformat -Wformat-security -fno-gnu-unique   -O3 -ggdb2 -falign-functions  -momit-leaf-frame-pointer -D_GNU_SOURCE -I. -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/src -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/src/flisp -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/src/support -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/include -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/include -I/d/a/llvm_julia_tester/llvm_julia_tester/julia/deps/valgrind -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden -fno-common -Wno-comment -Wpointer-arith -Wundef -Wno-unused-result -DJL_BUILD_ARCH='"x86_64"' -DJL_BUILD_UNAME='"NT"' -ID:\a\llvm_julia_tester\llvm_julia_tester\julia\usr\include -DLLVM_SHLIB "-DJL_SYSTEM_IMAGE_PATH=\"../lib/julia/sys.dll\"" "-DJL_LIBJULIA_SONAME=\"libjulia.dll\"" ./jltypes.o ./gf.o ./typemap.o ./smallintset.o ./ast.o ./builtins.o ./module.o ./interpreter.o ./symbol.o ./dlload.o ./sys.o ./init.o ./task.o ./array.o ./genericmemory.o ./staticdata.o ./toplevel.o ./jl_uv.o ./datatype.o ./simplevector.o ./runtime_intrinsics.o ./precompile.o ./jloptions.o ./mtarraylist.o ./threading.o ./scheduler.o ./stackwalk.o ./method.o ./jlapi.o ./signal-handling.o ./safepoint.o ./timing.o ./subtype.o ./rtutils.o ./crc32c.o ./APInt-C.o ./processor.o ./ircode.o ./opaque_closure.o ./codegen-stubs.o ./coverage.o ./runtime_ccall.o ./engine.o ./gc-common.o ./gc-stacks.o ./gc-alloc-profiler.o ./gc-heap-snapshot.o ./gc-stock.o ./gc-debug.o ./gc-pages.o ./gc-page-profiler.o ./win32_ucontext.o  -o /d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/bin/libjulia-internal.dll -Wl,--stack,8388608 --disable-auto-import --disable-runtime-pseudo-reloc   -L/d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib -L/d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/bin -Wl,--whole-archive ./flisp/libflisp.a -Wl,--whole-archive ./support/libsupport.a -ljulia -Wl,--whole-archive /d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libuv.a -Wl,--whole-archive /d/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libutf8proc.a -Wl,--no-whole-archive  -LD:\a\llvm_julia_tester\llvm_julia_tester\julia\usr/lib  -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle -lpsapi -lshell32 -lole32 -luuid -ladvapi32 -lws2_32 -lntdll -lz -luuid -lole32 -Wl,--export-all-symbols -Wl,--version-script=/d/a/llvm_julia_tester/llvm_julia_tester/julia/src/julia.expmap -Wl,--no-whole-archive -lpsapi -lkernel32 -lws2_32 -liphlpapi -lwinmm -ldbghelp -luserenv -lsecur32 -latomic -lole32 -lssp    
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libLLVMSupport.a(Timer.cpp.obj):Timer.cpp:(.text$_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_[_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_]+0xd): undefined reference to `std::__get_once_mutex()'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libLLVMSupport.a(Timer.cpp.obj):Timer.cpp:(.text$_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_[_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_]+0x93): undefined reference to `std::__set_once_functor_lock_ptr(std::unique_lock<std::mutex>*)'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libLLVMSupport.a(Timer.cpp.obj):Timer.cpp:(.text$_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_[_ZSt9call_onceIZN4llvm12TimerGlobals12initDeferredEvEUlvE_JEEvRSt9once_flagOT_DpOT0_]+0xb2): undefined reference to `std::__set_once_functor_lock_ptr(std::unique_lock<std::mutex>*)'
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/llvm_julia_tester/llvm_julia_tester/julia/usr/lib/libLLVMSupport.a(Timer.cpp.obj):Timer.cpp:(.rdata$.refptr._ZSt14__once_functor[.refptr._ZSt14__once_functor]+0x0): undefined reference to `std::__once_functor'
collect2.exe: error: ld returned 1 exit status

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildingBuild system, or building Julia or its dependenciessystem:windowsAffects only Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions