johnBuffer/AntSimulator

How to install on macOS?

Closed this issue · 8 comments

The README is too simple for newcomer.

Hello @jroutines, the first step would be to install dependencies (by using Brew):

brew install make cmake sfml gcc

After the dependencies be installed you could create the build configuration and invoke the build process by the next two commands from the root folder of the project:

cmake . -Bbuild
cmake --build build

Then, a binary AntSimulator file would appear at the build folder, which you could invoke from the root folder of the project by using:

build/AntSimulator

@jroutines

  1. Download Cmake and install cmake
  2. Downloadn SFML source and create a build folder in SFML folder (other place is ok too but it is normal to do what i said)
  3. Open Cmake and do what I show you
  4. Click Configure and Generate one by one (Now, your SFML is ready to be built)

image

  1. open command line and go to your SFML build folder
    image

  2. type in make and enter, you should see things flying
    image

  3. download AntSimulator and create a build folder in it

  4. Cmake and Configure button
    image

  5. After Configure button, tell Cmake where is your SFML
    image

  6. go to build folder and make

now you have build everything.

image

If you donot know what I said above then you should go to learn cmd line and what is cmake.

I assume this is not compatible with M1 mac?
Cuz I tried and it says ld: symbol(s) not found for architecture arm64 when I run make.
It is weird since I already have sfml built from source.
Maybe I need to hack cmakefile.txt.

@pancak3

It seems to me not an M1 problem. You better show your error message because ld: symbols missing is a common issue when you need some libs.

@duocang thanks for your help! I think I found the solution.

Previously, I compile SFML with the source code downloaded from the official website.
However, I found the released source code is 2.5.1 which released in 2018.
It surely does not support M1 chip although it allows you to compile for x86_64 and install.

I read the commits of their repository and found they support M1 chip since SFML/SFML@252d26a.

I compiled SFML with -DCMAKE_OSX_ARCHITECTURES=arm64.

Finally, I can compile AntSimulator without any error :)

But, it still cannot run with the following error,

./AntSimulator 
dyld: Library not loaded: @rpath/../Frameworks/freetype.framework/Versions/A/freetype
  Referenced from: /usr/local/sfml-graphics.framework/Versions/2.5.1/sfml-graphics
  Reason: no suitable image found.  Did find:
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
[1]    69888 abort      ./AntSimulator

It still looks like a problem of SFML instead.

@duocang thanks for your help! I think I found the solution.

Previously, I compile SFML with the source code downloaded from the official website.
However, I found the released source code is 2.5.1 which released in 2018.
It surely does not support M1 chip although it allows you to compile for x86_64 and install.

I read the commits of their repository and found they support M1 chip since SFML/SFML@252d26a.

I compiled SFML with -DCMAKE_OSX_ARCHITECTURES=arm64.

Finally, I can compile AntSimulator without any error :)

But, it still cannot run with the following error,

./AntSimulator 
dyld: Library not loaded: @rpath/../Frameworks/freetype.framework/Versions/A/freetype
  Referenced from: /usr/local/sfml-graphics.framework/Versions/2.5.1/sfml-graphics
  Reason: no suitable image found.  Did find:
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
[1]    69888 abort      ./AntSimulator

It still looks like a problem of SFML instead.

@pancak3 Can you please trybrew install freetype?

@duocang thanks for your help! I think I found the solution.
Previously, I compile SFML with the source code downloaded from the official website.
However, I found the released source code is 2.5.1 which released in 2018.
It surely does not support M1 chip although it allows you to compile for x86_64 and install.
I read the commits of their repository and found they support M1 chip since SFML/SFML@252d26a.
I compiled SFML with -DCMAKE_OSX_ARCHITECTURES=arm64.
Finally, I can compile AntSimulator without any error :)
But, it still cannot run with the following error,

./AntSimulator 
dyld: Library not loaded: @rpath/../Frameworks/freetype.framework/Versions/A/freetype
  Referenced from: /usr/local/sfml-graphics.framework/Versions/2.5.1/sfml-graphics
  Reason: no suitable image found.  Did find:
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
        /Library/Frameworks/freetype.framework/Versions/A/freetype: no matching architecture in universal wrapper
[1]    69888 abort      ./AntSimulator

It still looks like a problem of SFML instead.

@pancak3 Can you please trybrew install freetype?

Still :(

Hi:
This is with 11.2 on a Intel Mac.

I was able to compile and run with the following requisits:

  • Xcode
  • brew

With them installed, and with brew properly updated (brew update && brew upgrade), I did:

brew install sfml
git clone https://github.com/johnBuffer/AntSimulator.git
cd AntSimulator
mkdir build
cd build
CMAKE_PREFIX_PATH=/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/ ccmake ../

That crazy long CMAKE_PREFIX_PATH is so that Cmake finds the system's OpenGL libs and headers.

Then inside ccmake I did the usual 'c' for configure (CMAKE_BUILD_TYPE is 'Release', SFML is found, but OpenGL_DIR stays as not found), and 'g' for generate. Then 'make'.