cpp-best-practices / gui_starter_template

A template CMake project to get you started with C++ and tooling
The Unlicense
2.51k stars 445 forks source link

project triggers sigsegv on macos clang #180

Closed dbrumley closed 2 years ago

dbrumley commented 2 years ago

I could be making an obvious mistake, but this doesn't seem to build on macos 12.1 (monterey) and triggers a clang sigsegv with one of the dependencies. I've attached the build log, with the crux being:

-- Build files have been written to: /Users/dbrumley/.conan/data/spdlog/1.9.2/
_/_/build/c5863c4449d8a7b237b54af4fc090c66b790d6a5
[ 14%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/file_sin
ks.cpp.o
[ 28%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/cfg.cpp.
o
[ 42%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/stdout_s
inks.cpp.o
[ 57%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/spdlog.cpp.o
[ 71%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/async.cpp.o
[ 85%] Building CXX object source_subfolder/CMakeFiles/spdlog.dir/src/color_sinks.cpp.o
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)

Am I doing something wrong?

compile.log

LtdSauce commented 2 years ago

I have the same issue on fresh projects from this template without any changes. (in the github CI)

Looks like MacOs latest has changed? I guess this relates to: https://github.com/conan-io/conan-center-index/issues/8480 With the root cause beeing: https://github.com/fmtlib/fmt/issues/2455

lefticus commented 2 years ago

The closest we can get is MacOS-11 on github, but I've created a PR to look into it #193

ddalcino commented 2 years ago

Are you still seeing a sigsegv here? I am able to build both cpp_boilerplate_project and cpp_starter_project on Apple Silicon (macOS 12.3), and I haven't seen anything like that.

dbrumley commented 2 years ago

I upgraded to 10.3 (build 21E230) as well, so I can no longer check 10.1. I can confirm on 10.3 I am no longer getting a SIGSEGV.

It does not compile out-the-gate with cmake -S . -B ./build, though. Log attached.

cmake.log

ddalcino commented 2 years ago

It failed to build libiconv, which is a dependency of SDL2. I expect that if you remove the SDL example from your project, everything else will compile without a hitch.

You can try clearing your conan cache with conan remove '*' and trying again; sometimes that works.

I don't know what it is about the SDL2 conan package, but I have had so many issues with it not building properly on Linux that I often give up on it. When it does build properly, it can take multiple hours on Linux, and when you run the example program, it can't figure out how to write to the screen. I am able to build it on a Mac in just a few minutes, but the executable still can't draw to the screen. I've never had this kind of trouble with the Qt, FLTK or IMGUI examples.

If you want, we can open a new issue for the "SDL2 fails to build properly" issue (it's very much not Mac specific), but I think it's fair to close this issue since the sigsegv is no longer an issue for the current MacOS.

dbrumley commented 2 years ago

I'm going to close this issue.

FWIW, removing build, running conan remove '*', and what I think was removing SDL from the cmakelist didn't work. It's completely likely it's user error on my side; just didn't want to put in the time to figure it out.

I've found this project isn't really what I was looking for. I was looking for a fairly robust and simple CPP modern cmake template, while this is a more ambitious project. While I'm sure this has the right built-ins for serious CPP development and package management, it's not quite for me (I'm not a serious CPP developer).