BartVandewoestyne / Design-Patterns-GoF

Working code for the Design Patterns book from the Gang of Four.
277 stars 123 forks source link

Trying to build on MacOS Sonoma #7

Open Stefan-HU opened 7 months ago

Stefan-HU commented 7 months ago

Hello Bart! I'm trying to build your patterns on MacOS Sonoma but make would throw errors:

build % make
[ 1%] Building CXX object Foundation_Classes/CMakeFiles/foundation_classes.dir/Coord.cpp.o In file included from /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.cpp:2: /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.h:8:7: error: 'abs' is missing exception specification 'throw()'
Coord abs(Coord x); ^ throw() /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/stdlib.h:122:62: note: previous declaration is here _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float lcpp_x) _NOEXCEPT { ^ In file included from /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.cpp:2: /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.h:9:5: error: 'round' is missing exception specification 'throw()'
int round(Coord x); ^ throw() /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/math.h:1596:64: note: previous declaration is here _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT ^ /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.cpp:14:7: error: 'abs' is missing exception specification 'throw()'
Coord abs(Coord x) ^ throw() /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/stdlib.h:122:62: note: previous declaration is here _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float
lcpp_x) _NOEXCEPT { ^ /Users/stefanfuhrmann/Archiv/cs_books/Design-Patterns-GoF/Design-Patterns-GoF/Foundation_Classes/Coord.cpp:19:5: error: 'round' is missing exception specification 'throw()'
int round(Coord x) ^ throw() /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/math.h:1596:64: note: previous declaration is here _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT ^ 4 errors generated. make[2]: [Foundation_Classes/CMakeFiles/foundation_classes.dir/Coord.cpp.o] Error 1 make[1]: [Foundation_Classes/CMakeFiles/foundation_classes.dir/all] Error 2 make: *** [all] Error 2

Any ideas why that is and suggestions how to compile your project on MacOS? Thank you! Stefan

BartVandewoestyne commented 6 months ago

Hello @Stefan-HU , can you update your local copy and try again? I think commits b51dc0af59bfb6e854f867b6b87cb2afe1715ef2 and 2a7efc84edef7f94ab1301c9496d4d30a64bc557 will fix this issue, but since I have no MacOS to test on, can you please verify?

Stefan-HU commented 6 months ago

Hi Bart,Sorry for not getting back. Will do now and let u know soonish. Thank youStefan ——————————Am 12.02.2024 um 02:54 schrieb Bart Vandewoestyne @.***>: Hello @Stefan-HU , can you update your local copy and try again? I think commits b51dc0a and 2a7efc8 will fix this issue, but since I have no MacOS to test on, can you please verify?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Stefan-HU commented 6 months ago

make_logfile.txt CMakeCache.txt

Dear Bart, I stashed all my changes i did and then pulled your master via "git pull origin master". I ran "make clean", then cmake and then the suggested "make VERBOSE=1" and redirectet stdout and stderr to make_logfile.txt

the good news: It does compile something! :-) up until 24% whereas before it exited make with 1% and several errors. If your time allows: would you look at the logfiles and maybe tell me what to do?

Thank you for your patience and have a great day Stefan

BartVandewoestyne commented 6 months ago

I have added a macos-latest build job to the GitHub Actions workflow and I am able to reproduce your build issue. See https://github.com/BartVandewoestyne/Design-Patterns-GoF/actions/runs/7877574087/job/21494009418

The annoying thing is that I don't have a Mac myself so I have to commit and see if that fixes the build job. If anyone with a mac can debug and fix this locally and create a pull request, that would be helpful!

BartVandewoestyne commented 6 months ago

I've made some progress this evening and with commit 5dd2776fbcc2d9e711e93f0c88b961663705351a I now get to 74% of the MacOS build. See https://github.com/BartVandewoestyne/Design-Patterns-GoF/actions/runs/7879182146/job/21498957758

I'll continue later. Now it's time to sleep ;-)

BartVandewoestyne commented 6 months ago

I finalized all the fixes for the MacOS build and since commit 85f8812 the macos-latest build now passes. See https://github.com/BartVandewoestyne/Design-Patterns-GoF/actions/runs/7894112680/job/21544108346

@Stefan-HU, can you update your local copy and test this? The best way to do it is to first remove your build directory

rm -rf build/

and then use cmake to configure and build:

cmake -S . -B build
cmake --build build
BartVandewoestyne commented 6 months ago

@Stefan-HU or someone else having MacOS Sonoma, can you verify that things now build on your side so we can close this issue?