Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unable to build on Mac M1 due to Homebrew's different default install path #471

Closed
muskit opened this issue May 16, 2021 · 22 comments · Fixed by #655
Closed

[Bug] Unable to build on Mac M1 due to Homebrew's different default install path #471

muskit opened this issue May 16, 2021 · 22 comments · Fixed by #655

Comments

@muskit
Copy link

muskit commented May 16, 2021

Describe the bug
Since Homebrew installs itself onto /opt/homebrew on Mac M1, the build script fails when trying to build on Mac M1. Even after using VS Code to replace all instances of /usr/local with /opt/homebrew, the build still fails but a little further down the road.

To Reproduce

  1. Follow prep instructions on README
  • brew install cmake freetype libvorbis sdl2 libpng jpeg libarchive libiconv
  • git clone https://github.com/Drewol/unnamed-sdvx-clone
  • cd unnamed-sdvx-clone
  • git submodule update --init --recursive
  1. Use VS Code to replace all instances of /usr/local in the project folder with /opt/homebrew.
  2. Attempt to build the project
  • ./mac-cmake.sh
  • make

Expected behavior
An executable appears in the bin folder.

make log (before replacing /usr/local)

...
[ 38%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Config.cpp.o
[ 39%] Building CXX object Shared/CMakeFiles/Shared.dir/src/ConfigEntry.cpp.o
[ 39%] Building CXX object Shared/CMakeFiles/Shared.dir/src/FileStream.cpp.o
[ 40%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Interpolation.cpp.o
[ 40%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Jobs.cpp.o
[ 41%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Log.cpp.o
/Users/alex/git/unnamed-sdvx-clone/Shared/src/Log.cpp:145:9: warning: enumeration value '_Length' not handled in switch [-Wswitch]
        switch(severity)
               ^
/Users/alex/git/unnamed-sdvx-clone/Shared/src/Log.cpp:145:9: note: add missing switch cases
        switch(severity)
               ^
1 warning generated.
[ 41%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Math.cpp.o
[ 42%] Building CXX object Shared/CMakeFiles/Shared.dir/src/MemoryStream.cpp.o
[ 42%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Path.cpp.o
[ 43%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Random.cpp.o
[ 43%] Building CXX object Shared/CMakeFiles/Shared.dir/src/String.cpp.o
[ 43%] Building CXX object Shared/CMakeFiles/Shared.dir/src/StringEncodingConverter.cpp.o
/Users/alex/git/unnamed-sdvx-clone/Shared/src/StringEncodingConverter.cpp:9:10: fatal error: 'archive_entry.h' file not found
#include "archive_entry.h"
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [Shared/CMakeFiles/Shared.dir/src/StringEncodingConverter.cpp.o] Error 1
make[1]: *** [Shared/CMakeFiles/Shared.dir/all] Error 2
make: *** [all] Error 2

make log (after replacing /usr/local)

...
[ 45%] Building CXX object Shared/CMakeFiles/Shared.dir/src/TextStream.cpp.o
[ 45%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Transform.cpp.o
[ 46%] Building CXX object Shared/CMakeFiles/Shared.dir/src/UTF8.cpp.o
[ 46%] Building CXX object Shared/CMakeFiles/Shared.dir/src/VectorMath.cpp.o
[ 47%] Building CXX object Shared/CMakeFiles/Shared.dir/src/MacOS/Thread.cpp.o
[ 47%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Unix/Debug.cpp.o
[ 48%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Unix/File.cpp.o
[ 48%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Unix/Files.cpp.o
[ 49%] Building CXX object Shared/CMakeFiles/Shared.dir/src/Unix/Path.cpp.o
/Users/alex/git/unnamed-sdvx-clone/Shared/src/Unix/Path.cpp:104:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
1 warning generated.
[ 49%] Building CXX object Shared/CMakeFiles/Shared.dir/stdafx.cpp.o
[ 50%] Linking CXX static library ../lib/libShared_Release.a
[ 50%] Built target Shared
[ 50%] Building CXX object Graphics/CMakeFiles/Graphics.dir/src/Font.cpp.o
[ 51%] Building CXX object Graphics/CMakeFiles/Graphics.dir/src/Gamepad_Impl.cpp.o
[ 51%] Building CXX object Graphics/CMakeFiles/Graphics.dir/src/Image.cpp.o
/Users/alex/git/unnamed-sdvx-clone/Graphics/src/Image.cpp:8:10: fatal error: 'libpng16/png.h' file not found
#include "libpng16/png.h"
         ^~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [Graphics/CMakeFiles/Graphics.dir/src/Image.cpp.o] Error 1
make[1]: *** [Graphics/CMakeFiles/Graphics.dir/all] Error 2
make: *** [all] Error 2

System
MacBook Air 2020
M1 Apple Silicon
256 GB SSD
8 GB RAM

@Drewol
Copy link
Owner

Drewol commented May 17, 2021

Hi, can you see exactly which libpng that cmake found, if mac now comes with one version of the library by default then the homebrew version might need to be explicitly specified.

As for the different install paths, it seems that homebrew has a command brew shellenv that might be of use in building but I cannot really help much further as I do not have any Mac device.

@muskit
Copy link
Author

muskit commented May 18, 2021

brew shellenv is used for setting up brew variables in Terminal; I put it at the start of my .zprofile.
There used to be a libpng installation in /opt/X11/, but that X11 folder is now gone. Maybe the uninstallation wasn't clean?
I know basically nothing about CMake; how can I tell CMake where to look for libpng?

@muskit
Copy link
Author

muskit commented May 18, 2021

Here's something I tried: whenever a "file not found" error came up, I would go to the source code and prepend the faulty include with /opt/homebrew/include/. It got me pretty far, but now I've hit an awkward situation where a brew library's source file (vorbis/codec.h) can't find an include (ogg/ogg.h) that's provided by another brew library.

...
[ 60%] Building CXX object Audio/CMakeFiles/Audio.dir/src/AudioStream.cpp.o
In file included from /Users/alex/git/unnamed-sdvx-clone/Audio/src/AudioStream.cpp:5:
In file included from /Users/alex/git/unnamed-sdvx-clone/Audio/src/AudioStreamOgg.hpp:4:
In file included from /opt/homebrew/include/vorbis/vorbisfile.h:26:
/opt/homebrew/include/vorbis/codec.h:25:10: fatal error: 'ogg/ogg.h' file not found
#include <ogg/ogg.h>
         ^~~~~~~~~~~
1 error generated.
make[2]: *** [Audio/CMakeFiles/Audio.dir/src/AudioStream.cpp.o] Error 1
make[1]: *** [Audio/CMakeFiles/Audio.dir/all] Error 2
make: *** [all] Error 2

I ran make VERBOSE=1 and noticed that /opt/homebrew doesn't appear in any include argument at all.

[ 60%] Building CXX object Audio/CMakeFiles/Audio.dir/src/AudioStream.cpp.o
cd /Users/alex/git/unnamed-sdvx-clone/Audio && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCRASHDUMP -DLUA_USE_POSIX -DUNICODE -D_UNICODE -I/Users/alex/git/unnamed-sdvx-clone/Audio/include -I/Users/alex/git/unnamed-sdvx-clone/Audio/src -I/Users/alex/git/unnamed-sdvx-clone/Audio/include/Audio -I/Users/alex/git/unnamed-sdvx-clone/Audio -F/Library/Frameworks -I/Users/alex/git/unnamed-sdvx-clone/Shared/include -I/Users/alex/git/unnamed-sdvx-clone/third_party/lua-5.3.5/src -I/Users/alex/git/unnamed-sdvx-clone/third_party/soundtouch/include -I/Users/alex/git/unnamed-sdvx-clone/third_party/minimp3 -I/Users/alex/git/unnamed-sdvx-clone/third_party/miniaudio -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -std=gnu++17 -MD -MT Audio/CMakeFiles/Audio.dir/src/AudioStream.cpp.o -MF CMakeFiles/Audio.dir/src/AudioStream.cpp.o.d -o CMakeFiles/Audio.dir/src/AudioStream.cpp.o -c /Users/alex/git/unnamed-sdvx-clone/Audio/src/AudioStream.cpp
In file included from /Users/alex/git/unnamed-sdvx-clone/Audio/src/AudioStream.cpp:5:
In file included from /Users/alex/git/unnamed-sdvx-clone/Audio/src/AudioStreamOgg.hpp:4:
In file included from /opt/homebrew/include/vorbis/vorbisfile.h:26:
/opt/homebrew/include/vorbis/codec.h:25:10: fatal error: 'ogg/ogg.h' file not found
#include <ogg/ogg.h>
         ^~~~~~~~~~~

@muskit
Copy link
Author

muskit commented May 19, 2021

I've decided to create symlinks /usr/local/include and /usr/local/opt to point to the /opt/homebrew/ counterparts, which seems to have helpd quite a bit. However I'm now getting an error related to the code:

[ 71%] Building CXX object Main/CMakeFiles/usc-game.dir/src/CalibrationScreen.cpp.o
In file included from /Users/alex/git/unnamed-sdvx-clone/Main/src/CalibrationScreen.cpp:6:
/Users/alex/git/unnamed-sdvx-clone/Main/../third_party/nuklear/nuklear.h:422:1: error: '_dummy_array422' declared as an array with a negative size
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/alex/git/unnamed-sdvx-clone/Main/../third_party/nuklear/nuklear.h:291:75: note: expanded from macro 'NK_STATIC_ASSERT'
  #define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
                                                                          ^~~~~~~~~~
/Users/alex/git/unnamed-sdvx-clone/Main/../third_party/nuklear/nuklear.h:423:1: error: '_dummy_array423' declared as an array with a negative size
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/alex/git/unnamed-sdvx-clone/Main/../third_party/nuklear/nuklear.h:291:75: note: expanded from macro 'NK_STATIC_ASSERT'
  #define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
                                                                          ^~~~~~~~~~
2 errors generated.
make[2]: *** [Main/CMakeFiles/usc-game.dir/src/CalibrationScreen.cpp.o] Error 1
make[1]: *** [Main/CMakeFiles/usc-game.dir/all] Error 2
make: *** [all] Error 2

@muskit
Copy link
Author

muskit commented May 19, 2021

I managed to get a successful build on my M1 Mac! All it took was, without doing any aforementioned VS Code path changing:

  • creating a couple aliases
    • /usr/local/include ---> /opt/homebrew/include
    • /usr/local/opt ---> /opt/homebrew/opt
  • commenting out the datatype checks in third_party/nuklear/nuklear.h (lines 415-423)
// NK_STATIC_ASSERT(sizeof(nk_short) == 2);
// NK_STATIC_ASSERT(sizeof(nk_ushort) == 2);
// NK_STATIC_ASSERT(sizeof(nk_uint) == 4);
// NK_STATIC_ASSERT(sizeof(nk_int) == 4);
// NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
// NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*)); // commenting just this and next line would have sufficed according to my previous comment's error message
// NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));

However, this is a workaround and the symlink may need to be removed to keep things clean.

@rullinoiz
Copy link

I managed to get a successful build on my M1 Mac! All it took was, without doing any aforementioned VS Code path changing:

  • creating a couple aliases

    • /usr/local/include ---> /opt/homebrew/include
    • /usr/local/opt ---> /opt/homebrew/opt
  • commenting out the datatype checks in third_party/nuklear/nuklear.h (lines 415-423)

// NK_STATIC_ASSERT(sizeof(nk_short) == 2);
// NK_STATIC_ASSERT(sizeof(nk_ushort) == 2);
// NK_STATIC_ASSERT(sizeof(nk_uint) == 4);
// NK_STATIC_ASSERT(sizeof(nk_int) == 4);
// NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
// NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*)); // commenting just this and next line would have sufficed according to my previous comment's error message
// NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));

However, this is a workaround and the symlink may need to be removed to keep things clean.

wow, this saved me an evening of trying to figure out why make doesnt see the files that i explicitly told it to look at. thanks

@DaGinYus
Copy link

DaGinYus commented Aug 15, 2021

@Drewol
Attempting to compile on my intel mac yields the same error. The output from mac-cmake.sh seems to indicate that CMake is finding the wrong version of libpng:

-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Freetype: /usr/local/lib/libfreetype.dylib (found version "2.11.0")
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found SDL2: /Library/Frameworks/SDL2.framework
-- Found PNG: /usr/local/lib/libpng.dylib (found version "1.4.12")
-- Found JPEG: /usr/local/lib/libjpeg.dylib (found version "80")
-- Found Vorbis: /usr/local/include
-- Found OGG: optimized;/usr/local/lib/libogg.dylib;debug;/usr/local/lib/libogg.dylib
-- Found LibArchive: /usr/local/opt/libarchive/lib/libarchive.dylib (found version "3.5.1")
-- Performing Test Iconv_IS_BUILT_IN
-- Performing Test Iconv_IS_BUILT_IN - Failed
-- Found Iconv: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/lib/libiconv.tbd (found version "1.11")

How could I tell CMake to use the correct version?

@ghost
Copy link

ghost commented Nov 16, 2021

I managed to get a successful build on my M1 Mac! All it took was, without doing any aforementioned VS Code path changing:

* creating a couple aliases
  
  * `/usr/local/include` ---> `/opt/homebrew/include`
  * `/usr/local/opt` ---> `/opt/homebrew/opt`

* commenting out the datatype checks in `third_party/nuklear/nuklear.h` (lines 415-423)
// NK_STATIC_ASSERT(sizeof(nk_short) == 2);
// NK_STATIC_ASSERT(sizeof(nk_ushort) == 2);
// NK_STATIC_ASSERT(sizeof(nk_uint) == 4);
// NK_STATIC_ASSERT(sizeof(nk_int) == 4);
// NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
// NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
// NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*)); // commenting just this and next line would have sufficed according to my previous comment's error message
// NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));

However, this is a workaround and the symlink may need to be removed to keep things clean.

This did not work for me, however:
Copying the .h files that were missing in the Graphics and Audio directories from /opt/homebrew/include and doing the commenting on nuklear.h seems to give a successful build.

@aidswidjaja
Copy link

aidswidjaja commented Jan 1, 2022

If you're still experiencing the above issue (even on an Intel Mac such as me) and the above didn't help, it could have been a simple case of accidentally not reading through the caveats for libarchive when installing through Homebrew :D

For example, on fish shell on my Intel Mac:

~> brew reinstall libarchive
...
==> Caveats
libarchive is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libarchive first in your PATH, run:
  echo 'fish_add_path /usr/local/opt/libarchive/bin' >> ~/.config/fish/config.fish

For compilers to find libarchive you may need to set:
  set -gx LDFLAGS "-L/usr/local/opt/libarchive/lib"
  set -gx CPPFLAGS "-I/usr/local/opt/libarchive/include"
...

so I simply ran the commands

~> echo 'fish_add_path /usr/local/opt/libarchive/bin' >> ~/.config/fish/config.fish
~> set -gx LDFLAGS "-L/usr/local/opt/libarchive/lib"
~> set -gx CPPFLAGS "-I/usr/local/opt/libarchive/include"

If you're using another shell such as bash, you can convert the fish notation to bash notation, or more easily just run brew reinstall libarchive and it will throw you the correct commands.

After this, it compiled as normal :)

@jsoleymanzadeh
Copy link

jsoleymanzadeh commented Mar 8, 2022

I tried all of the above methods, but none of them worked (using M1 Mac). However, I did find my own solution. I have libarchive installed via homebrew, so it is located in /opt/homebrew/opt/libarchive. I was able to get USC compiled by editing the file paths in the mac-cmake.sh file before running it.

Old:

cmake . -DLibArchive_LIBRARY=/usr/local/opt/libarchive/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=/usr/local/opt/libarchive/include -DCMAKE_BUILD_TYPE=Release

New:

cmake . -DLibArchive_LIBRARY=/opt/homebrew/opt/libarchive/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=/opt/homebrew/opt/libarchive/include -DCMAKE_BUILD_TYPE=Release

In hindsight, I think the alias method would have worked for me, but my libarchive directories were slightly different.

@Drewol
Copy link
Owner

Drewol commented Mar 8, 2022

What I think should be done is to use the brew shellenv command and use the variables that it exports as those should be correct no matter which OS version, Mac model, or brew version is being used. However I don't have a mac so I would have to experiment with that using the CI which is not a good time. If someone with a mac can look into that it would be appreciated.

@jsoleymanzadeh
Copy link

jsoleymanzadeh commented Mar 8, 2022

EDIT: I made a mistake here. Please see my posts below.

I just tried again using the $HOMEBREW_CELLAR variable and was able to successfully compile.

cmake . -DLibArchive_LIBRARY=$HOMEBREW_CELLAR/libarchive/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=$HOMEBREW_CELLAR/libarchive/include -DCMAKE_BUILD_TYPE=Release

I only have access to my Mac though, so it would probably be best to get a second opinion.

@Drewol
Copy link
Owner

Drewol commented Mar 9, 2022

I'm not sure about CELLAR, does this work?

cmake . -DLibArchive_LIBRARY=$HOMEBREW_PREFIX/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=$HOMEBREW_PREFIX/include -DCMAKE_BUILD_TYPE=Release

@jsoleymanzadeh
Copy link

jsoleymanzadeh commented Mar 9, 2022

That doesn't work for me. Also I realize I made a small mistake in my last post. I had meant to type $HOMEBREW_PREFIX/opt/. Here's my directory structure:

/
    opt/
        homebrew/
            Cellar/
                libarchive/
                    3.6.0/
                        lib/
                            libarchive.dylib
                        include/
                            archive_entry.h
                            archive.h
            opt/
                libarchive/ <-- this is an alias that points to the 3.6.0 directory

And here are my variables:

HOMEBREW_PREFIX="/opt/homebrew"
HOMEBREW_CELLAR="/opt/homebrew/Cellar"
HOMEBREW_REPOSITORY="/opt/homebrew"

There is an include directory in /opt/homebrew, but archive_entry.h and archive.h are not inside it. Everything in the /opt/homebrew/opt directory are aliases that point to stuff inside /opt/homebrew/Cellar, so I'm assuming the aliases are to bypass the version number changes that would change the name of the 3.6.0 directory. I'm not sure about the different purposes between HOMEBREW_PREFIX and HOMEBREW_REPOSITORY variables though.

@Drewol
Copy link
Owner

Drewol commented Mar 9, 2022

ah ok, becauseI checked HOMEBREW_CELLAR on the linux verison of homebrew and it seemed to contain version specific folders which would likely work but would not be ideal. So my suggestion was based on the linux version.

However $HOMEBREW_PREFIX/opt/libarchive/include and $HOMEBREW_PREFIX/opt/libarchive/lib/libarchive.dylib should be fine then assuming aliases work, which they should.

On linux HOMEBREW_REPOSITORY contains the path to the homebrew installation, which is not the exact same as HOMEBREW_PREFIX

@jsoleymanzadeh
Copy link

Yep, I can confirm that those paths work.

cmake . -DLibArchive_LIBRARY=$HOMEBREW_PREFIX/opt/libarchive/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=$HOMEBREW_PREFIX/opt/libarchive/include -DCMAKE_BUILD_TYPE=Release

@Drewol
Copy link
Owner

Drewol commented Mar 12, 2022

the Mac build script has now been updated to use environment variables from homebrew, would be good to get confirmation from a few people that it's better now before I can close the mac build issues

@ConnorWhalen
Copy link

I am trying to install on my intel mac and I was in in the same state as @DaGinYus. I had tried the new mac-cmake.sh and got the libpng error when building. Like DaGinYus, my CMakeCache is saying it found libpng at /usr/local/lib/libpng.dylib. Idk about them but my mac is a bit older and also stores homebrew at /usr/local instead of /opt/homebrew. So my understanding is that cmake was finding the wrong version of libpng.

I found this SO post that goes over the issue (I also have an old mono framework kicking around on my machine). Doing their quick and dirty solution of adding set(CMAKE_FIND_FRAMEWORK LAST) to CmakeLists.txt worked for me!

I don't think there's necessarily any action to be taken from this. I'm not super keen on cmake but it's not the first time i've had issues with it locating the wrong instance of a library and i think it's more of a "me" issue. I figured I'd post in case anyone else ends up in the same situation.

@Lucen0312
Copy link

Lucen0312 commented Apr 17, 2022

the Mac build script has now been updated to use environment variables from homebrew, would be good to get confirmation from a few people that it's better now before I can close the mac build issues

I was able to build it. Everything was working very fine except the skin that I use.

@fmorisan
Copy link

fmorisan commented Aug 4, 2022

Intel MacBook Pro (2020) here.

Got a successful build by manually adding -I/usr/local/include to the CXX_INCLUDE var in all flags.make files for troublesome components.
e.g. Graphics/CMakeFiles/Graphics.dir/flags.make, Audio/CMakeFIles/Audio.dir/flags.make

This was quite a tedious process as it was trial and error... CMake is so arcane that I can't even comprehend what the way to fix it would look like.

@Asapmoy87
Copy link

heeeeeeeeelp lol

@SkyLeite
Copy link

Here's a working mac-cmake.sh:

eval "$(brew shellenv)"
cmake . \
    -DLibArchive_LIBRARY=$HOMEBREW_PREFIX/opt/libarchive/lib/libarchive.dylib \
    -DLibArchive_INCLUDE_DIR=$HOMEBREW_PREFIX/opt/libarchive/include \
    -DCMAKE_BUILD_TYPE=Release \
    -DJPEG_LIBRARY=$HOMEBREW_PREFIX/opt/libjpeg/lib/libjpeg.dylib \
    -DJPEG_INCLUDE_DIR=$HOMEBREW_PREFIX/opt/libjpeg/include \
    -DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=$HOMEBREW_PREFIX/opt/libjpeg/include

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet