Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Possible issue with Apple M1 processor  (Read 4342 times)

0 Members and 1 Guest are viewing this topic.

j.keller51

  • Newbie
  • *
  • Posts: 17
    • View Profile
Possible issue with Apple M1 processor
« on: December 18, 2020, 10:38:17 pm »
I'm not making an issue for this yet because I don't have access to a computer with Apple's new M1 processor, so I can't confirm 100% if the issue lies with SFML or not. But just something to keep an eye out for:

Users of my application on M1 are not seeing any graphics that are being drawn to an sf::RenderTexture. Everything drawn directly to the window seems to be working fine.

j.keller51

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Possible issue with Apple M1 processor
« Reply #1 on: February 04, 2021, 02:54:38 am »
I can confirm that the issue does not lie with SFML.

The max antialiasing level on M1 chips is 4, and my code was set to use 8. When I changed it to 4, all RenderTextures worked again (still compiled for x86_64 and run through Rosetta).

I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Possible issue with Apple M1 processor
« Reply #2 on: February 04, 2021, 09:26:55 am »
I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.
Does that mean you also built SFML and its dependencies for arm64?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

j.keller51

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Possible issue with Apple M1 processor
« Reply #3 on: February 04, 2021, 04:04:20 pm »
It does indeed! No changes to the source were required.

j.keller51

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Possible issue with Apple M1 processor
« Reply #4 on: February 04, 2021, 06:07:09 pm »
^ An addendum -- I had manually changed the build architecture through Xcode to arm64 and it worked without changing any source.

However, I wanted CMake to set the architecture automatically, so I set CMAKE_OSX_ARCHITECTURES to "x86_64;arm64". However, SFML's CMakeLists.txt is hardcoded to reject anything that is not x86_64 on Mac.

I made an issue for this:

https://github.com/SFML/SFML/issues/1749

For the time being, I just commented out the architecture check in the SFML CMakeLists in my local copy.

unflippedbit

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Possible issue with Apple M1 processor
« Reply #5 on: February 20, 2021, 04:34:37 am »
I went a step further and compiled my project for arm64 and it runs natively on the M1 flawlessly.

Hey, thanks for this thread, I've been trying to run sfml on my new m1 macbook for a while with little success. I actually tried compiling directly to arm 64 like you said, but immediately got this: imgur.com/a/LrydYjM do you think I have the wrong libraries/dylink installed, or is the issue with my compilation settings? Sorry, I'm pretty new to all the C++ building processes. Thanks in advance.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Possible issue with Apple M1 processor
« Reply #6 on: February 20, 2021, 07:49:00 pm »
The M1 chip uses a completely different architecture, as such you can't reuse existing library builds, but you have to recompile everything. You need to compile SFML from source and for that you need to compile all of SFML's dependencies from source.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Possible issue with Apple M1 processor
« Reply #7 on: March 23, 2021, 08:20:45 pm »
Good news, I've just merged the dependency update PR, with that you should be able to use SFML on a device with an Apple M1 chip targeting arm64.

Additionally, a Mac Mini with an M1 chip has joined our CI fleet and is also publishing snapshot builds for those who don't want to build from source.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything