MarbleMarcher icon indicating copy to clipboard operation
MarbleMarcher copied to clipboard

Failed to compile on OSX

Open joaquincasares opened this issue 6 years ago • 12 comments

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!

joaquincasares avatar Jan 09 '19 18:01 joaquincasares

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

Jbaud avatar Jan 09 '19 20:01 Jbaud

@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

ncovercash avatar Jan 09 '19 22:01 ncovercash

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

lateralpunk avatar Jan 10 '19 07:01 lateralpunk

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 [email protected] 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.

ncovercash avatar Jan 10 '19 13:01 ncovercash

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

lateralpunk avatar Jan 10 '19 17:01 lateralpunk

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.

jgoldfar avatar Jan 10 '19 17:01 jgoldfar

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.

nobodywasishere avatar Jan 16 '19 02:01 nobodywasishere

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

@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

nobodywasishere avatar Jan 17 '19 00:01 nobodywasishere

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

)

mygizli04 avatar Jan 26 '19 19:01 mygizli04

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.

ivankolesnik avatar Mar 19 '19 13:03 ivankolesnik

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

joaquincasares avatar Mar 19 '19 14:03 joaquincasares