Windows build fails on MinGW GCC 13 due to libssp changes #51740
Closed
Description
opened on Oct 17, 2023
Compiling Julia on Windows with GCC 13 from MSYS2 (which is the only available compiler) fails during linking:
LINK build2/usr/bin/libjulia-codegen.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ./codegen.o: in function `add_named_global':
C:/Users/Tim/Julia/src/julia/src/codegen.cpp:549:(.text+0x26a53): undefined reference to `__imp___stack_chk_guard'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/c/Users/Tim/Julia/src/julia/src/Makefile:412: /c/Users/Tim/Julia/src/julia/build2/usr/bin/libjulia-codegen.dll] Error 1
make: *** [/c/Users/Tim/Julia/src/julia/Makefile:97: julia-src-release] Error 2
This is on #51698, because otherwise the CSL static libraries break the build.
I'm not entirely sure where we should be getting __stack_chk_guard
from; it's defined in rtutils.c
, but HAVE_SSP
is set, so that code isn't activated:
Lines 218 to 228 in 4d2d849
Meanwhile, libssp.dll
from CSL has the symbol:
❯ objdump -p ./usr/bin/libssp-0.dll | grep stack
[ 6] __stack_chk_fail
[ 7] __stack_chk_guard
... and we do link this DLL, but that somehow doesn't seem to help:
g++ -march=native -mtune=native -m64 -shared -Wl,--out-implib,/c/Users/Tim/Julia/src/julia/build2/usr/lib/libjulia-codegen.dll.a -pipe -fno-rtti -std=c++14 -fno-gnu-unique -O3 -ggdb2 -falign-functions -momit-leaf-frame-pointer -D_GNU_SOURCE -I. -I/c/Users/Tim/Julia/src/julia/src -I/c/Users/Tim/Julia/src/julia/src/flisp -I/c/Users/Tim/Julia/src/julia/src/support -I/c/Users/Tim/Julia/src/julia/build2/usr/include -I/c/Users/Tim/Julia/src/julia/build2/usr/include -I/c/Users/Tim/Julia/src/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"' -IC:\Users\Tim\Julia\src\julia\build2\usr\include -DLLVM_SHLIB "-DJL_SYSTEM_IMAGE_PATH=\"../lib/julia/sys.dll\"" "-DJL_LIBJULIA_SONAME=\"libjulia.dll\"" ./codegen.o ./jitlayers.o ./aotcompile.o ./debuginfo.o ./disasm.o ./llvm-simdloop.o ./llvm-muladd.o ./llvm-final-gc-lowering.o ./llvm-pass-helpers.o ./llvm-late-gc-lowering.o ./llvm-ptls.o ./llvm-lower-handlers.o ./llvm-gc-invariant-verifier.o ./llvm-propagate-addrspaces.o ./llvm-multiversioning.o ./llvm-alloc-opt.o ./llvm-alloc-helpers.o ./cgmemmgr.o ./llvm-remove-addrspaces.o ./llvm-remove-ni.o ./llvm-julia-licm.o ./llvm-demote-float16.o ./llvm-cpufeatures.o ./pipeline.o ./llvm_api.o -o /c/Users/Tim/Julia/src/julia/build2/usr/bin/libjulia-codegen.dll -Wl,--stack,8388608 -L/c/Users/Tim/Julia/src/julia/build2/usr/lib -L/c/Users/Tim/Julia/src/julia/build2/usr/bin -LC:\Users\Tim\Julia\src\julia\build2\usr/lib -lLLVM-15jl -Wl,--export-all-symbols -Wl,--version-script=/c/Users/Tim/Julia/src/julia/build2/src/julia.expmap -Wl,--no-whole-archive -lpsapi -lkernel32 -lws2_32 -liphlpapi -lwinmm -ldbghelp -luserenv -lsecur32 -latomic -lssp -ljulia -ljulia-internal
cc @vtjnash
See below for a MWE, and the link to upstream changes causing this.
Workaround: override HAVE_SSP := 0
in Make.user
.
Activity