HackerPoet / MarbleMarcher

A Fractal Physics Game
GNU General Public License v2.0
2.48k stars 168 forks source link

Failed to compile on OSX #9

Open joaquincasares opened 5 years ago

joaquincasares commented 5 years ago

I stumbled upon this via Reddit. Cool looking game!

First, I needed to also install cmake:

brew install cmake

But I'm still having issues on the cmake command:

[Wed Jan 09] 12:49 PM:~/repos/personal/MarbleMarcher/build[master] (casares)$ brew reinstall sfml
==> Reinstalling sfml
==> Downloading https://homebrew.bintray.com/bottles/sfml-2.4.2_1.mojave.bottle.1.tar.gz
Already downloaded: /Users/casares/Library/Caches/Homebrew/downloads/5225f9fe06926bc770df12433ea4585e34775e491eae886cce1b38bc822cbca3--sfml-2.4.2_1.mojave.bottle.1.tar.gz
==> Pouring sfml-2.4.2_1.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/sfml/2.4.2_1: 132 files, 1.7MB
[Wed Jan 09] 12:49 PM:~/repos/personal/MarbleMarcher/build[master] (casares)$ cmake ..
CMake Error at CMakeLists.txt:8 (find_package):
  By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SFML", but
  CMake did not find one.

  Could not find a package configuration file provided by "SFML" (requested
  version 2.5) with any of the following names:

    SFMLConfig.cmake
    sfml-config.cmake

  Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
  "SFML_DIR" to a directory containing one of the above files.  If "SFML"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
See also "/Users/casares/repos/personal/MarbleMarcher/build/CMakeFiles/CMakeOutput.log".

Thanks for any help!

Jbaud commented 5 years ago

The latest version available on brew is the 2.4.2. This game requires 2.5 so you will have to download sfml from their website.

After doing that I had to modify the cmake file as instructed by the installer and set CMAKE_PREFIX_PATH and SFML_DIR in the mable marcher directory.

Hope that helps

ncovercash commented 5 years ago

@Jbaud What did you modify? I never saw anything about the cmake file in the installer. I installed SFML per sfml-dev.org's instructions, and now get the following output from cmake --build build:

-- Found SFML 2.5.1 in /Library/Frameworks/SFML.framework/Resources/CMake
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/redacted/MarbleMarcher/build
[ 12%] Building CXX object src/CMakeFiles/MarbleMarcherSources.dir/Overlays.cpp.o
In file included from /Users/redacted/MarbleMarcher/src/Overlays.cpp:17:
/Users/redacted/MarbleMarcher/src/Overlays.h:18:10: fatal error: 'SFML/Graphics.hpp' file not found
#include <SFML/Graphics.hpp>
         ^~~~~~~~~~~~~~~~~~~

1 error generated.
make[2]: *** [src/CMakeFiles/MarbleMarcherSources.dir/Overlays.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/MarbleMarcherSources.dir/all] Error 2
make: *** [all] Error 2
lateralpunk commented 5 years ago

I found a temporary fix. in build/src/CmakeFiles/MarbleMarcerSources.dir/flags.make, manually type the include path to SFML as it is missing

CXX_INCLUDES = -I/usr/local/include/eigen3 -I/Users/k5patel/workspace/computer-graphics/SFML/include

ncovercash commented 5 years ago

Ayy, it compiled!

Now the only issue I have is

Failed to open shader file "assets/vert.glsl"
Failed to compile vertex shader

I'll fiddle with it some and see if I can't make that work

Le 10 janv. 2019 à 02:27, Krunal Patel notifications@github.com a écrit :

I found a temporary fix. in build/src/CmakeFiles/MarbleMarcerSources.dir/flags.make, manually type the include path to SFML as it is missing

CXX_INCLUDES = -I/usr/local/include/eigen3 -I/Users/k5patel/workspace/computer-graphics/SFML/include

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/HackerPoet/MarbleMarcher/issues/9#issuecomment-452996455, or mute the thread https://github.com/notifications/unsubscribe-auth/AHomX-hCX-CwwFZTmMEtby1sVcLyTQDOks5vButQgaJpZM4Z4GEA.

lateralpunk commented 5 years ago

just manually copy the built executable over to the root directory.

jgoldfar commented 5 years ago

You can accomplish the same as below

I found a temporary fix. in build/src/CmakeFiles/MarbleMarcerSources.dir/flags.make, manually type the include path to SFML as it is missing

CXX_INCLUDES = -I/usr/local/include/eigen3 -I/Users/k5patel/workspace/computer-graphics/SFML/include

at the configuration step by passing by passing something like -DCMAKE_CXX_FLAGS="-I/usr/local/include/eigen3 ..." to cmake.

nobodywasishere commented 5 years ago

The latest version available on brew is the 2.4.2. This game requires 2.5 so you will have to download sfml from their website.

After doing that I had to modify the cmake file as instructed by the installer and set CMAKE_PREFIX_PATH and SFML_DIR in the mable marcher directory.

Hope that helps

How did you download it from their website? I downloaded a folder with doc, Frameworks, examples, etc in it but I'm completely lost on what to do with it.

BaconWrappedShrimpWithEyes commented 5 years ago

The tutorial on the sfml website will teach you how to install it.

nobodywasishere commented 5 years ago

@lateralpunk What path are you talking about? As I do not have anything remotely similar on my computer.

I found a temporary fix. in build/src/CmakeFiles/MarbleMarcerSources.dir/flags.make, manually type the include path to SFML as it is missing

CXX_INCLUDES = -I/usr/local/include/eigen3 -I/Users/k5patel/workspace/computer-graphics/SFML/include

mygizli04 commented 5 years ago

I installed the sfml manually, and now it says success but no binary. ( Here's the terminal log:

bash-3.2$ cmake -build build
-- Found SFML 2.5.1 in /Library/Frameworks/SFML.framework/Resources/CMake
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/USER/Desktop/MarbleMarcher/build

)

ivankolesnik commented 5 years ago

As of today, SFML in Homebrew is already updated to version 2.5.1. I managed to build with this sequence:

mkdir build && cd build
cmake -DCMAKE_CXX_FLAGS="-I/usr/local/include" ..
cd ..
cmake --build build

And it produced a binary file. Also I think that /usr/local/include folder should be added in flags.make file.

joaquincasares commented 5 years ago

This now builds and I'm able to run it with:

LD_LIBRARY_PATH=`pwd`/usr/lib ./build/MarbleMarcher

~However, the graphics get glitchy as soon as the level is built and mainly disappear as the world spins.~ Nevermind, it works! The mouse sensitivity is found on the Pause Screen and can be fixed a bit. Glad to see it though! :D