flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
24.66k stars 1.58k forks source link

Apple Silicon M1 support #1302

Closed merrcury closed 2 years ago

merrcury commented 3 years ago

When can we expect native support of flameshot for Apple Silicon Processors?

borgmanJeremy commented 3 years ago

When someone donates one 😝 In all seriousness when someone with an M1 wants to do the code contribution and testing is when support will be added.

I also don't know the state of Qt on M1s

holazt commented 3 years ago

Qt 6.2 will support Apple Silicon (arm64). https://bugreports.qt.io/browse/QTBUG-85279

merrcury commented 3 years ago

Qt 6.2 will support Apple Silicon (arm64). https://bugreports.qt.io/browse/QTBUG-85279

That's sweet.

sam0delkin commented 3 years ago

for those who concern, i was able to compile flameshot for M1. Looks like brew is already have an ARM formula for qt@5: https://formulae.brew.sh/formula/qt@5 so, i just used the script from README.md:

brew install qt5
brew install cmake
mkdir build
cd build
cmake ../
make

note, that i was need to use CMAKE_PREFIX_PATH to set a correct path to qt5 that was installed by homebrew

kholisrag commented 3 years ago

how can I help to make this released to the release page ?

borgmanJeremy commented 3 years ago

You will need to update the CI scripts

mmahmoudian commented 3 years ago

@petrukngantuk we use Github Actions to build the Flameshot for different platforms. You can find all our scripts here:

https://github.com/flameshot-org/flameshot/tree/master/.github/workflows

There is already a Mac script which you might find it very handy

kholisrag commented 3 years ago

well after some digging, the issue was the github actions workflows still not support macos arm64 arch, I can help with building it using self hosted runner, but it's quite tricky and not long term solution, wdyt ?

holazt commented 3 years ago

well after some digging, the issue was the github actions workflows still not support macos arm64 arch, I can help with building it using self hosted runner, but it's quite tricky and not long term solution, wdyt ?

Is it possible to cross-compile Apple Silicon(ARM64) binaries on Intel-based Macs (x86_64)?

borgmanJeremy commented 3 years ago

I think maybe we could move the Mac build to TravisCI if it's still free for FOSS

holazt commented 3 years ago

About Qt official release, Qt 5.15.4 support MacOS Big Sur ARM64, but you must have a commercial license.

The article mentions "Some patches already went into Qt 5, so Qt 5.15.4 and above should build and run by passing -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 to configure. Note that this configuration is not tested in CI, and is hence unsupported at this point."

The community version will not support MacOS ARM64 and Windows ARM64 until Qt6.2. https://wiki.qt.io/New_Features_in_Qt_6.2

Most CI platforms currently do not have a MacOS ARM64 environment. Therefore, there are only two ways left:

  1. use QEMU to emulate MacOS ARM64, this approach is difficult as far as QEMU is concerned. Although some people have successfully tried it out, it is still very complicated. see https://blogs.blackberry.com/en/2021/05/strong-arming-with-macos-adventures-in-cross-platform-emulation and https://github.com/cylance/macos-arm64-emulation
  2. cross-compile, which should be feasible. Using osxcross should work, successful case https://github.com/bitcoin/bitcoin/issues/20371#issuecomment-871090816. But of course you need to cross-compile the source code of Qt 5.15.2(need apply some patches, Available at https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qt@5.rb).

Plus, The native compiled ARM64 version can be found here.

brew install qt@5 brew install cmake mkdir build cd build cmake ../ make

There is also a macdeployqt-universal tool that can be used.

holazt commented 2 years ago

@mmahmoudian @borgmanJeremy Qt 6.2 LTS released. https://www.qt.io/blog/qt-6.2-lts-released it's mentioned at Qt blog,

Qt 6.2 fully supports macOS on Apple Silicon. Qt now makes it easy to create universal binaries and to develop for macOS on both Intel and Apple Silicon. Of course, that version is also fully tested in our CI system. It has always been possible to run Qt applications on Apple silicon via the Rosetta layer, but Qt 6.2 now provides full support to run natively on the Apple silicon.

kholisrag commented 2 years ago

Any plan to upgrade to Qt 6.2 shortly?

borgmanJeremy commented 2 years ago

It's not in our plan for the upcoming release. Perhaps the release after that?

borgmanJeremy commented 2 years ago

I ended up getting an M1 air and the lastest master branch is working perfectly on it, it did not require an upgrade to qt6.2. The only thing to figure out is if we need to update the CI.

asyba commented 2 years ago

I ended up getting an M1 air and the lastest master branch is working perfectly on it, it did not require an upgrade to qt6.2. The only thing to figure out is if we need to update the CI.

strange for me, when i opened the app is not doing anything, no errors and not opening.

borgmanJeremy commented 2 years ago

Did you try compiling from source?

asyba commented 2 years ago

Did you try compiling from source?

no, just with the dmg file from this github repo https://github.com/flameshot-org/flameshot/releases

borgmanJeremy commented 2 years ago

Okay that goes back to needing to update the CI so it builds a package for aarch64 in addition to x86. I think if you build from source it will work.

kholisrag commented 2 years ago

I tried many approach to do cross-compile in qt5, but no luck for success, always got a problem when it linking the binary, maybe lack of knowledge from myself how to properly crosscompile qt5

you can check it out here

borgmanJeremy commented 2 years ago

Maybe this helps? https://github.com/crystalidea/macdeployqt-universal

Edit: Why do you uninstall qt@5 with brew before building? I think the problem is cmake is looking there for the qt tools used in generating the MOC files.

kholisrag commented 2 years ago

Maybe this helps? https://github.com/crystalidea/macdeployqt-universal

Edit: Why do you uninstall qt@5 with brew before building? I think the problem is cmake is looking there for the qt tools used in generating the MOC files.

will try to look at that universal macdeployqt I just realized that there is hardcoded brew --prefix in the ~2/3 place in cmakelist.txt, and its make custom qt5 installation directory path not working as expected and will try to depend my understanding about cmake first

borgmanJeremy commented 2 years ago

Since flameshot is working perfectly fine on Rosetta I am going to close this.

realityworks commented 2 years ago

@borgmanJeremy why are you closing this when Apple Silicon M1 support is still not native to bitcoin core... :/

borgmanJeremy commented 2 years ago

Because I don't intend to work on this. It is running fine on Rosetta.

If someone else can figure out how to build a universal image in our CI I'll happily merge that, but don't have time to work this when their is no real value.

JessePeden commented 2 years ago

Because I don't intend to work on this. It is running fine on Rosetta.

If someone else can figure out how to build a universal image in our CI I'll happily merge that, but don't have time to work this when their is no real value.

Functioning in Rosetta is one thing, but by not running natively it causes additional power draw from the system, especially when the helper is running in the background constantly. So, the "real value" is having the system perform better and not draining the battery as fast. For heavy users, that drain may be more of an issue than it is for the occasional/casual user.

mmahmoudian commented 2 years ago

especially when the helper is running in the background constantly

You can invoke Flameshot in a one-off mode (explained in the release notes of v11.0.0) which will remove the background process as soon as Flameshot is closed.

Regarding the M1, it would be nice if some of you can work on it and add M1 support to this Free and Libre OpenSource Software. Any form of contribution is most welcome 🤗

rylincoln commented 2 years ago

Although nice to have - in my experience running flameshot under rosetta works flawlessly and does not noticeably impact energy consumption on an M1 device. (chrome however does a lot ... 😄 ) image

muthusk commented 11 months ago

Looks like recently Public Beta of M1 Mac runners for Github actions were made available. Would this help in getting flameshot for Mac M1s natively without having to use rosetta? @borgmanJeremy

msavdert commented 6 months ago

that would be great

+1