GabrieleGiuseppini / Floating-Sandbox

Mass-spring network in C++, simulating physical bodies floating in water and sinking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling on macOS

The-SamminAter opened this issue · comments

commented

Hello, I figured that it might be easier and quicker in the long run if I add compilation issues here, instead of sending them on discord.
Compilation is being done on macOS Catalina (10.15.2), with CMake 3.16.3 3.17.1 and Xcode 11.3.1 11.4.1 with the default SDK.

Errors and warnings:

FloatingSandbox Group
	Semantic Issue Group
		/Users/ffs/Downloads/Floating-Sandbox-github/FloatingSandbox/SettingsDialog.cpp:85:13: Use of undeclared identifier 'BBB_SHIP_ICON_xpm'
			/usr/local/include/wx-3.0/wx/gdicmn.h:190:31: Expanded from macro 'wxICON'
			/Users/ffs/Downloads/Floating-Sandbox-github/<scratch space>:82:1: Expanded from here
GameLib Group
	Semantic Issue Group
		/Users/ffs/Downloads/Floating-Sandbox-github/Game/ShipRenderContext.cpp:2230:26: Use of undeclared identifier 'mHighlightVertexBuffer'

I think that I also got the same googletest warnings, so here are those (these are from the last document that I sent you):

UnitTests Group
	Deprecations Group
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/GameMathTests.cpp:24:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/GameMathTests.cpp:82:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/LayoutHelperTests.cpp:60:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/LayoutHelperTests.cpp:390:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/SegmentTests.cpp:12:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/SliderCoreTests.cpp:16:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/TaskThreadPoolTests.cpp:56:1: 'InstantiateTestCase_P_IsDeprecated' is deprecated: INSTANTIATE_TEST_CASE_P is deprecated, please use INSTANTIATE_TEST_SUITE_P
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/gtest-param-test.h:504:38: Expanded from macro 'INSTANTIATE_TEST_CASE_P'
			/Users/ffs/Downloads/googletest-master/googletest/include/gtest/internal/gtest-internal.h:1236:1: 'InstantiateTestCase_P_IsDeprecated' has been explicitly marked deprecated here

Awesome move, Sam! It will definitely be easier!

commented

Please disregard my last (now deleted) comment, I am compiling now. The errors and warnings will go where the last ones should have, in the original comment/issue

commented

@GabrieleGiuseppini errors and warnings are now in the original comment/issue

Sam, you may try now.

I'm also upgrading to googletest 1.10, will get rid of the deprecation warnings soon.

commented

Understood.
The issues that I received building (excluding UnitTests issues):

FloatingSandbox Group
	Semantic Issue Group
                /Users/ffs/Downloads/Floating-Sandbox-github/FloatingSandbox/StandardSystemPaths.cpp:17:50: No member named 'GetUserDir' in 'wxStandardPaths'
                /Users/ffs/Downloads/Floating-Sandbox-github/FloatingSandbox/StandardSystemPaths.cpp:17:78: No member named 'Dir' in 'wxStandardPaths'

The UnitTests issues are now gone, you may pull.
Regarding these new issues, which version of wxWidgets are you using? Should be at least 3.1.2...

commented

I checked, I am using wxmac 3.0.4_2. I'll try to update that.
It says on wxmac's homebrew page that the latest version is 3.0.5...

commented

Should I download 3.1.3's source and build it? It might not work.

commented

I'm going to try to do that, if it doesn't work then I'll remove it and install homebrew's version again.

It would be awesome if you could try to build 3.1.2 or 3.1.3; according to this it shouldn't be a hassle: https://docs.wxwidgets.org/trunk/plat_osx_install.html. Let me know if it's a huge pain.

commented

I'm running make right now, I am just not sure where my wxWidgets_ROOT_DIR should be set to after it's done.

I normally set it to the folder that ends up having the "include" and "lib" subfolders, but according to the Mac guide, you should try this first: "simply use the full path to wx-config under the build directory when building application using the library"

commented

Here is the current issue:

UnitTests Group
	Semantic Issue Group
		/Users/ffs/Downloads/Floating-Sandbox-github/UnitTests/GameEventDispatcherTests.cpp:22:12: No matching constructor for initialization of 'StructuralMaterial'
			/Users/ffs/Downloads/Floating-Sandbox-github/Game/Materials.h:116:5: Candidate constructor not viable: requires 25 arguments, but 24 were provided
			/Users/ffs/Downloads/Floating-Sandbox-github/Game/Materials.h:17:8: Candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 24 were provided
			/Users/ffs/Downloads/Floating-Sandbox-github/Game/Materials.h:17:8: Candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 24 were provided

Hey Sam, fixed - thanks to much!

Try again, let me know how it goes.

commented

It succeeded!

What shall I do now? I don't see any easy way to run it, though I may have missed something.

That is fantastic news Sam!!! Definitely a statement to your patience and determination!!! Good job! I'm closing this ticket now as the original issue has been fixed. I'll try to get in touch with you over Discord for the next step.

Did this ever evolve into build instructions or a downloadable binary? I’d like to give this a try but the only non-macOS computer I have is a bit low power (surface go 2).

Alternatively I could try it on windows VM.

Update: surface go 2 was able to pull 25fps. Nice work on the code efficiency! 💪🏻

Are you asking whether the game has been built on a MacOS, or are you asking instead whether it has been built on Windows?

If it's the former, not yet :-( It's definitely complicated to debug from Central Europe to West Coast :-)
If it's the latter, definitely - Floating Sandbox has been available on Windows since 2018 and on Linux for at least one year - check it out at https://gamejolt.com/games/floating-sandbox/353572.

Are you asking whether the game has been built on a MacOS

This one. Sorry for being unclear :)

My main computers are all macOS, so I was hoping there was a build (or build instructions) I could use on those.

Seems like @The-SamminAter was able to get it working, so if I could get some details I was thinking maybe I could do the same.

But on the bright side, the only (low powered) windows machine I have available was able to run Floating Sandbox just fine. My son was very excited and has been playing with it all week. Great job!

Hi,

Indeed, Sam was able to build it a couple of times, but was never fully reproducible.

The instructions he followed are basically the same as for Ubuntu, which you may find at https://github.com/GabrieleGiuseppini/Floating-Sandbox/blob/master/BUILD-Ubuntu.md. One caveat though, building requires std::filesystem, which as far as I know is only available with XCode 11 and may only target MacOS >= 10.15 (see https://stackoverflow.com/questions/58667853/does-use-of-c17-stdfilesystem-require-macos-10-15-xcode-11-1).

I would be EXTREMELY grateful if you could give it a try and let me know your experience!!!! And I'd be ever more grateful if you managed to build it!!! Let me know how it goes!!!!

commented

I didn't make any progress last attempted build, but let me update my scripts and try again.

Thanks for the pointers @GabrieleGiuseppini - I'll see if I can make any progress. Sounds like maybe @The-SamminAter did something similar but I'm thinking this could be a script that does all the cloning and building under a common subfolder.

Maybe not suited for daily dev work, but might be good enough to produce a binary from the repo master.

Update: I got this far in an hour or so https://gist.github.com/matschaffer/87220798c79a5d0ace1eaa9afb729d28 it's stuck on pthread resolution though

commented

That is basically where I am currently at, but my setup is a bit more complex because everything has to be statically compiled. Anyways, I've been pretty busy lately, but I may have some free time soon to look at how CMake is expecting libpthread to be. Afaik, it is included in every macOS installation as /usr/bin/libpthread.dylib, so I don't have to statically compile it, but I just haven't had much time to poke for hours to figure this out.

When I finally get this working I will document and share my (cleaned up) build scripts and other related files.

Indeed gents, pthread seems to be a bottleneck, which is quite surprising given it's ubiquitous. Note this at line 95 in the main CMake file of FS:

if(APPLE)
	find_package(pthread REQUIRED)
	find_package(iconv REQUIRED)
endif()

I wonder whether the first find_package should be removed. Can you try commenting that out?

Thanks @GabrieleGiuseppini - that seemed to resolve the pthread error. Next up is

CMake Error at /usr/local/Cellar/sfml/2.5.1_2/lib/cmake/SFML/SFMLConfig.cmake:139 (message):
  Requested SFML configuration (Static) was not found

I attempted to use a homebrew install of SFML to avoid this error when using cmake

Installing: /Library/Frameworks/FLAC.framework - permission denied

I'll start digging for a more appropriate way to build and install SFML on macos.

Update: Using the instructions on https://www.sfml-dev.org/tutorials/2.3/start-osx.php#installing-sfml yielded the same error. Then I found SFML/SFML#1496 which mentioned SFML_DEPENDENCIES_INSTALL_PREFIX. This seems to get a local SFML building as expected.

commented

I have brew build scripts for static SFML and all other components which I will share when successful, Floating Sandbox is currently not buildable for a different issue which I have informed Gabriele of, and should hopefully be fixed in ~12 hours.

Thanks @The-SamminAter ! With the update SFML build I was able to get cmake succeeding for Floating-Sandbox. I posted the script and new make install error to https://gist.github.com/matschaffer/87220798c79a5d0ace1eaa9afb729d28 (same gist as before).

Hey @matschaffer , do you mind making a pull request for Floating Sandbox adding the mac script and with CMakeLists.txt pthread fix?

@matschaffer, regarding building SFML: so you're saying that you fixed the SFML issue by building (and installing) SFML after on setting SFML_DEPENDENCIES_INSTALL_PREFIX to the path that you then specify in Floating Sandbox's UserSettings.cmake?

Want to know as I'd like to create build instructions for Mac as well.

do you mind making a pull request for Floating Sandbox adding the mac script and with CMakeLists.txt pthread fix?

Will do! Though we may want to delay merge until someone gets a successful build on macos :)

after on setting SFML_DEPENDENCIES_INSTALL_PREFIX to the path that you then specify in Floating Sandbox's UserSettings.cmake?

Yep. Setting SFML_DEPENDENCIES_INSTALL_PREFIX on https://gist.github.com/matschaffer/87220798c79a5d0ace1eaa9afb729d28/revisions#diff-ecd5e3363adeee15ede23abbf594c7b7b2e680f47067c762a4898df7f0fbd301R37 allowed me to build SMFL as expected. Without that it was attempting to install FLAC to a root-writeable location (/Library/Frameworks/FLAC.framework). This is the same behavior outlined in SFML/SFML#1496

Gave this another run today. Opened #75, #76 and ran the script on https://gist.github.com/matschaffer/87220798c79a5d0ace1eaa9afb729d28, see gist for latest error.

For context, I can run the windows build fine, so no rush to try to fix the macos build.

But I'm happy to keep trying as long as it's useful to you.

Success!

Looks like ignoring the vorbis errors in the SFML build was fine. Sounds seems to be working.

One "gotcha" is that I think previously using homebrew to install sfml might have done the job of downloading the dependent libraries. So it's not super clear if this would work on a fresh mac or not. So I included that brew install as a note in the script.

Screen Shot 2022-10-19 at 23 13 03

Hey, that's fantastic! I've merged your pull requests!
Would you mind sending a pull request for the two build scripts once you verify they're complete?

Will do!