Skip to content

Rework CMake #12747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Rework CMake #12747

wants to merge 1 commit into from

Conversation

BratishkaErik
Copy link
Contributor

@BratishkaErik BratishkaErik commented Sep 5, 2022

Closes #12722

@BratishkaErik BratishkaErik marked this pull request as ready for review September 11, 2022 08:06
@BratishkaErik BratishkaErik changed the title [DRAFT] Rework CMake Rework CMake Sep 11, 2022
@andrewrk
Copy link
Member

Thank you. This looks like good work. Can you share the set of systems that you tested it on?

@BratishkaErik
Copy link
Contributor Author

Thank you. This looks like good work. Can you share the set of systems that you tested it on?

Gentoo and Arch. I hitted this bug in Windows MSYS2, but it looks irrelevant:

[189/195] Linking CXX static library zigcpp\libzigcpp.a
[190/195] Linking CXX static library zigcpp\libzigstage1.a
[191/195] Linking CXX executable zig1.exe
[192/195] Building stage2 object C:/msys64/home/▒▒▒▒/zig/build/zig2.obj
FAILED: zig2.obj C:/msys64/home/▒▒▒▒/zig/build/zig2.obj
cmd.exe /C "cd /D C:\msys64\home\▒▒▒▒\zig && C:\msys64\home\▒▒▒▒\zig\build\zig1.exe src/stage1.zig --name zig2 --zig-lib-dir C:/msys64/home/▒▒▒▒/zig/lib -femit-bin=C:/msys64/home/▒▒▒▒/zig/build/zig2.obj -fcompiler-rt  -target native -mcpu baseline -lc --pkg-begin build_options C:/msys64/home/▒▒▒▒/zig/build/config.zig --pkg-end --pkg-begin compiler_rt C:/msys64/home/▒▒▒▒/zig/lib/compiler_rt.zig --pkg-end"
Assertion failed at C:/msys64/home/▒▒▒▒/zig/src/stage1/os.cpp:1143 in utf8Decode2. This is a bug in the Zig compiler.
ninja: build stopped: subcommand failed.

@BratishkaErik
Copy link
Contributor Author

Reproducible on master, fixed by removing Cyrillic characters from path (moved to another directory)

@BratishkaErik
Copy link
Contributor Author

BratishkaErik commented Sep 12, 2022

[194/195] Linking CXX executable zig2.exe
FAILED: zig2.exe
cmd.exe /C "cd . && C:\msys64\mingw64\bin\c++.exe -O3 -DNDEBUG -Wl,--stack,16777216 zig2.obj CMakeFiles/zig2.dir/src/stage1/empty.cpp.obj -o zig2.exe -Wl,--out-implib,zigcpp\libzig2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -L/lib zigcpp/libzigstage1.a  -lntdll  zigcpp/libopt_c_util.a  zigcpp/libembedded_softfloat.a  zigcpp/libzigcpp.a  C:/msys64/mingw64/lib/libclang-cpp.dll.a  C:/msys64/mingw64/lib/liblldMinGW.a  C:/msys64/mingw64/lib/liblldELF.a  C:/msys64/mingw64/lib/liblldCOFF.a  C:/msys64/mingw64/lib/liblldWasm.a  C:/msys64/mingw64/lib/liblldMachO.a  C:/msys64/mingw64/lib/liblldCommon.a  C:/msys64/mingw64/bin/libLLVM-14.dll  -lpsapi  -lshell32  -lole32  -luuid  -ladvapi32  -lpthread  -lz  -lxml2  -lversion  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0x136): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0x6c6): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0x796): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0x866): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0x936): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.text+0xa06): more undefined references to `__stack_chk_fail' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.obj:zig2:(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Same on master:

[3/4] Linking CXX executable zig2.exe
FAILED: zig2.exe
cmd.exe /C "cd . && C:\msys64\mingw64\bin\c++.exe -O3 -DNDEBUG -Wl,--stack,16777216 zig2.o CMakeFiles/zig2.dir/src/stage1/empty.cpp.obj -o zig2.exe -Wl,--out-implib,zigcpp\libzig2.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -L/lib zigcpp/libzigstage1.a  -lntdll  zigcpp/libopt_c_util.a  zigcpp/libembedded_softfloat.a  zigcpp/libzigcpp.a  -lclang-cpp  -Wl,-Bstatic  -llldMinGW  -llldELF  -llldCOFF  -llldWasm  -llldMachO  -llldCommon  -Wl,-Bdynamic  C:/msys64/mingw64/bin/libLLVM-14.dll  -lpsapi  -lshell32  -lole32  -luuid  -ladvapi32  -lpthread  -lz  -lxml2  -lversion  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x136): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x6c6): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x796): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x866): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0x936): undefined reference to `__stack_chk_fail'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.text+0xa06): more undefined references to `__stack_chk_fail' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: zig2.o:zig2:(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

UPD: sounds like #12703 (comment)

@BratishkaErik
Copy link
Contributor Author

Ready I think.

@BratishkaErik
Copy link
Contributor Author

If you want, I can extract fix for #12722 to the new PR, so you won't need to check all changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate installing and building self-hosted compiler
2 participants