Giter Site home page Giter Site logo

Comments (19)

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Hmm, does homebrew say anything when installing SDL2?

For openal-soft, it says this, for example, at least on the Catalina VMs of the GitHub Actions runners: https://github.com/xoreos/xoreos/runs/5177204214?check_suite_focus=true#step:3:64

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

No, SDL2 is fine for anything else that is using it, and there is no notification from homebrew when installing.

I did try using brew doctor and also reinstalled it as well, but it still didn't work.

If anyone else had an M1 (and uses homebrew), maybe they can test.

If it's an issue with my install, that's fine. If not, well the fix is recorded here.

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

By the way, the GitHub actions are x86 though, am I right?
I believe that homebrew has moved things around so x86 and arm stuff can co-exist...

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Yeah, it looks to me like homebrow changed something. The GitHub runners should be x86, yeah. As were the Travis CI macOS VMs, IRC, back when Travis CI was still alive.

I basically just moved over the information in the Travis CI config into GitHub Actions workflow. I don't really know a lot about the Apple ecosystem, so I'm mostly just guessing and messing with things until they work :). I personally don't have a Mac at the moment, even, unfortunately, nevermind an M1 one, so I can't really check.

Can you modify our cmake/FindSDL2.cmake file? In the find_path in the else-branch on line 32, can you add /opt/homebrew/include/SDL2 to the HINTS paths?

I.e., replace that line with

find_path(SDL2_INCLUDE_DIR SDL.h HINTS /usr/include/SDL2 /usr/local/include/SDL2 /opt/local/include/SDL2 /opt/homebrew/include/SDL2 DOC "The directory where SDL.h resides")

Also, apart from this, can you also check using the autotools build system instead of cmake? Have a look at https://github.com/xoreos/xoreos/blob/master/.github/workflows/macos_autoconf_clang.yml#L24 to see how that is used. If that is broken on your system as well, this would also need to be fixed, I guess. We're using the sdl2-config script that SDL2 distributes there. If the configure script fails, please check where homebrew puts it

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

Firstly, yes, replacing the line allows cmake to locate the includes correctly.

Secondly, I haven't tried using the auto tools before so I'll just have a poke around and report back later.

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

Yes, it looks like the configure script needs to be altered...

The autogen.sh ran fine.
The configure script couldn't locate sdl2-config

checking for sdl2-config... sdl2-config configure: error: SDL2 (>= 2.0.0) is required and could not be found!

running which sdl2-config in terminal gives me: /opt/homebrew/bin/sdl2-config

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Wait, if which can find it, it's in the PATH, so the configure script should also find it?

What does sdl2-config --cflags --libs output? And can you attach, upload or gist your config.log file?

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

-I/opt/homebrew/include/SDL2 -D_THREAD_SAFE
-L/opt/homebrew/lib -lSDL2

config.log

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Oh. That looks rather like a bug in our ax_check_sdl2.m4 script.

Can you edit the file m4/ax_check_sdl2.m4, and change the line that says

#include <SDL2/SDL.h>

to

#include <SDL.h>

?

You need to rerun autogen.sh, and then the configure script. And then make, if configure runs through without error.

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

We're getting close!

No error from SDL2, but now I have one for Boost.

checking for Boost headers version >= 1.53.0... no
configure: error: cannot find Boost headers version >= 1.53.0

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Can you attach the config.log again? Thanks

And where does homebrew put the boost headers (and libraries)?

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

config.log

Headers are in opt/homebrew/include/boost

Libraries are......I guess opt/homebrew/lib...? Check the screenshot here and see if these are the libraries you mean:

Screenshot 2022-02-14 at 20 58 55

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Yep, those are the libraries

Okay, so does homebrew not install anything into /usr/local/ anymore now?

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

Don't quote me on this, but I think that's where homebrew puts x86 stuff.

It's still a transition period, and it's common enough for people with M1s to still have to compile x86 versions of software and run through Rosetta.

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Ah, okay, that makes sense. It's a bit annoying, though :P

Can you apply this patch and retry (starting with autogen.sh)? homebrew_boost_m4.patch.txt

You'll apply those with patch -p1 < homebrew_boost_m4.patch.txt, in case you're not familiar with them.

EDIT: This is assuming you're in the project's root directory. The -p flag specificies how many directories to strip off the path that's in the patch file. If you're inside the m4 directory, you need to pass -p2

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

The scripts ran fine, and I was able to compile successfully.

Screenshot 2022-02-14 at 21 26 32

Thanks :)

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Nice :)

So in summary, what's needed is the following:

  • Add /opt/homebrew to cmake/FindSDL2.cmake
  • Add /opt/homebrew to m4/boost.m4
  • Remove the extra SDL2 directory in the include directory in m4/ax_check_sdl2.m4

DId I miss anything?

The first two points are due to changes in homebrew for M1 Macs. While the latter one is actually a bug in our configure script that only didn't show any consequences before now.

(Or technically, it might a fault of SDL2, that their sdl2-config script shouldn't add the SDL2 directory to their include directive, but that's something they do on all platforms.)

And the first one makes our CMake build system work on M1 Macs, while the latter two make our autotools build systems works on M1 Macs.

I'll need to check that none of the changes break anything on my local cross-compilers, so a public fix in the repo might take a while. Just as a heads up. But in either case, thanks for finding those issues :)

from xoreos.

shinra-electric avatar shinra-electric commented on May 20, 2024

Yes, I think that’s it.

πŸ‘πŸΌ

from xoreos.

DrMcCoy avatar DrMcCoy commented on May 20, 2024

Okay, fixed in fa430d3...87d09c6

from xoreos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.