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

Compile blisp flasher on an M1 Mac #34

Open
kayloehmann opened this issue Apr 9, 2023 · 18 comments
Open

Compile blisp flasher on an M1 Mac #34

kayloehmann opened this issue Apr 9, 2023 · 18 comments
Assignees

Comments

@kayloehmann
Copy link

Hi there,

I just tried to compile blisp flasher on an M1 Mac and got the following error. Could you please have a look? Thx.

➜  Downloads git clone --recursive https://github.com/pine64/blisp.git
Klone nach 'blisp'...
remote: Enumerating objects: 739, done.
remote: Counting objects: 100% (242/242), done.
remote: Compressing objects: 100% (134/134), done.
remote: Total 739 (delta 132), reused 175 (delta 96), pack-reused 497
Empfange Objekte: 100% (739/739), 262.14 KiB | 3.12 MiB/s, fertig.
Löse Unterschiede auf: 100% (315/315), fertig.
Submodul 'vendor/argtable3' (https://github.com/argtable/argtable3) für Pfad 'vendor/argtable3' in die Konfiguration eingetragen.
Submodul 'vendor/libserialport' (https://github.com/sigrokproject/libserialport/) für Pfad 'vendor/libserialport' in die Konfiguration eingetragen.
Klone nach '/Users/d038842/Downloads/blisp/vendor/argtable3'...
remote: Enumerating objects: 759, done.        
remote: Counting objects: 100% (158/158), done.        
remote: Compressing objects: 100% (81/81), done.        
remote: Total 759 (delta 92), reused 89 (delta 75), pack-reused 601        
Empfange Objekte: 100% (759/759), 695.13 KiB | 2.49 MiB/s, fertig.
Löse Unterschiede auf: 100% (484/484), fertig.
Klone nach '/Users/d038842/Downloads/blisp/vendor/libserialport'...
remote: Enumerating objects: 1449, done.        
remote: Counting objects: 100% (176/176), done.        
remote: Compressing objects: 100% (9/9), done.        
remote: Total 1449 (delta 174), reused 167 (delta 167), pack-reused 1273        
Empfange Objekte: 100% (1449/1449), 365.70 KiB | 4.57 MiB/s, fertig.
Löse Unterschiede auf: 100% (983/983), fertig.
Submodul-Pfad 'vendor/argtable3': '6f0e40bc44c99af353ced367c6fafca8705f5fca' ausgecheckt
Submodul-Pfad 'vendor/libserialport': '6f9b03e597ea7200eb616a4e410add3dd1690cb1' ausgecheckt
➜  Downloads cd blisp
➜  blisp git:(master) git submodule update --init --recursive
➜  blisp git:(master) mkdir build && cd build
➜  build git:(master) cmake -DBLISP_BUILD_CLI=ON ..
-- The C compiler identification is AppleClang 14.0.3.14030022
-- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/d038842/Downloads/blisp/build
➜  build git:(master) cmake --build .
[  3%] Building C object CMakeFiles/libblisp_obj.dir/lib/blisp.c.o
[  6%] Building C object CMakeFiles/libblisp_obj.dir/lib/chip/blisp_chip_bl60x.c.o
[  9%] Building C object CMakeFiles/libblisp_obj.dir/lib/chip/blisp_chip_bl70x.c.o
[ 12%] Building C object CMakeFiles/libblisp_obj.dir/lib/blisp_easy.c.o
[ 16%] Building C object CMakeFiles/libblisp_obj.dir/vendor/libserialport/serialport.c.o
[ 19%] Building C object CMakeFiles/libblisp_obj.dir/vendor/libserialport/timing.c.o
[ 22%] Building C object CMakeFiles/libblisp_obj.dir/vendor/libserialport/macosx.c.o
/Users/d038842/Downloads/blisp/vendor/libserialport/macosx.c:45:35: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
                                         ^~~~~~~~~~~~~~~~~~~~
                                         kIOMainPortDefault
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
const mach_port_t kIOMasterPortDefault
                  ^
/Users/d038842/Downloads/blisp/vendor/libserialport/macosx.c:213:35: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
        if (IOServiceGetMatchingServices(kIOMasterPortDefault, classes,
                                         ^~~~~~~~~~~~~~~~~~~~
                                         kIOMainPortDefault
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
const mach_port_t kIOMasterPortDefault
                  ^
2 warnings generated.
[ 22%] Built target libblisp_obj
[ 25%] Linking C shared library shared/libblisp.dylib
[ 25%] Built target libblisp
[ 29%] Linking C static library static/libblisp.a
[ 29%] Built target libblisp_static
[ 32%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_cmd.c.o
[ 35%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_date.c.o
[ 38%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_dbl.c.o
[ 41%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_dstr.c.o
[ 45%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_end.c.o
[ 48%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_file.c.o
[ 51%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_hashtable.c.o
[ 54%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_int.c.o
[ 58%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_lit.c.o
[ 61%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_rem.c.o
[ 64%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_rex.c.o
[ 67%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_str.c.o
[ 70%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_utils.c.o
[ 74%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/argtable3.c.o
[ 77%] Building C object tools/blisp/argtable3/src/CMakeFiles/argtable3.dir/arg_getopt_long.c.o
[ 80%] Linking C static library libargtable3_static.a
[ 80%] Built target argtable3
[ 83%] Building C object tools/blisp/CMakeFiles/blisp.dir/src/main.c.o
[ 87%] Building C object tools/blisp/CMakeFiles/blisp.dir/src/cmd/write.c.o
[ 90%] Building C object tools/blisp/CMakeFiles/blisp.dir/src/util.c.o
/Users/d038842/Downloads/blisp/tools/blisp/src/util.c:21:8: error: use of undeclared identifier '_NSGetExecutablePath'
  if (!_NSGetExecutablePath(raw_path_name, &raw_path_size)) {
       ^
1 error generated.
make[2]: *** [tools/blisp/CMakeFiles/blisp.dir/src/util.c.o] Error 1
make[1]: *** [tools/blisp/CMakeFiles/blisp.dir/all] Error 2
make: *** [all] Error 2
@River-Mochi
Copy link
Collaborator

River-Mochi commented Apr 9, 2023

Hello, not a mac person but someone else can help you on build from code questions.

image

@kayloehmann
Copy link
Author

kayloehmann commented Apr 9, 2023

Thanks for pointing this out, I tried it before and got this result:

➜  firmware sudo ./blisp write -c bl70x --reset Pinecilv2_DE.bin
sudo: ./blisp: command not found

The blisp file is in the same folder as Pinecilv2_DE.bin

@River-Mochi
Copy link
Collaborator

Thanks for pointing this out, I tried it before and got this result:

➜  firmware sudo ./blisp write -c bl70x --reset Pinecilv2_DE.bin
sudo: ./blisp: command not found

The blisp file is in the same folder as Pinecilv2_DE.bin

I will try to take a guess based on my knowledge since Mac people are not around yet.

  1. Are you are inside the blisp folder before you do the sudo command?
  2. change folders in your Terminal so you are inside folder with both blisp and Pinecilve_DE.bin
    and then do the command again
    don't type the word "firmware" before the word sudo.
    sudo ./blisp write -c bl70x --reset Pinecilv2_EN.bin

@kayloehmann
Copy link
Author

kayloehmann commented Apr 9, 2023

Yes, that is exactly what I did. firmware is just the folder that contains the blisp file and the bin. Still:
sudo: ./blisp: command not found
Maybe it is an issue with the fact that blisp has not be compiled for arm architecture (M1).

Oic in that case. we need to wait for @gamelaster

It's not clear which exact architectures the macOS binary covers.

@kayloehmann
Copy link
Author

I just got it working by setting permissions like this: chmod +x ./blisp
Thanks guys for helping out!

@River-Mochi
Copy link
Collaborator

@kayloehmann also if you feel like it you could join Pinecil live chat channel. see what people think. it can be joined from either Discord or telegram or matrix.
https://wiki.pine64.org/wiki/Pinecil#Live_Community_Chat

someone else was saying in live Chat just now that there is an issue with Build from Code for MacOS users that has not been fixed yet.

@River-Mochi
Copy link
Collaborator

River-Mochi commented Apr 9, 2023

@kayloehmann someone else also in live chat says they got blisp to work with M1 . you probably saw chat before I could post this image.

have to set permissions . I'm not Mac person and I had to ask around that is often why getting in the live chat is good. lots of people there with different experience.

cd blispFolder # move into the folder with blisp and BIN file.
ls -l # to see permissions
chmod +x ./blisp # make blisp executable
sudo ./blisp write -c bl70x --reset Pinecilv2_EN.bin run the command inside the Blisp folder.

image

@kayloehmann
Copy link
Author

Yes! It solved it. Thx.

@dotsam
Copy link

dotsam commented Apr 11, 2023

While the x86_64 release of blisp will work on an Apple Silicon Mac, I still wanted a native arm64 version. The fix for compiling from source for me was to add the header #include <mach-o/dyld.h> inside the __APPLE__ ifdef at

#ifdef __APPLE__
// Ugh. This stuff is just so messy without C++17 or Qt...
// These are not thread safe, but it doesn't place the responsibility
// to free an allocated buffer on the caller.nn
#include <stdlib.h>

@River-Mochi
Copy link
Collaborator

River-Mochi commented Apr 12, 2023

The fix for compiling from source for me

@dotsam
is this something that could be submitted as a Pull Request to the blisp repo so that it will automatically work for other ARM64 Mac people?

is the new Mac binary made from arm64 able to be zipped and shared with people in this repo?

@River-Mochi River-Mochi reopened this Apr 12, 2023
@robertlipe
Copy link
Collaborator

robertlipe commented Apr 12, 2023 via email

@gamelaster
Copy link
Member

There is working CI. But only for X86 Macs 😉

@River-Mochi
Copy link
Collaborator

River-Mochi commented Apr 12, 2023

There is working CI. But only for X86 Macs 😉

CI works for x86 and M1 Macs right now. the M1 macs we confirmed yesterday, they just need to do:

chmod +x to make the Blisp executable

someone told me that if you repackage it and do the permission change before you zip it. then mac people will not need to to the chmod +x. don't know if you have time to do that? and then rezip it?

@Alex-52
Copy link

Alex-52 commented Apr 26, 2023

@dotsam Thx, also working for Apple M2.

@robertlipe
Copy link
Collaborator

If the build doesn't create an executable with execute permissions, the build system should be fixed, IMO. The error shown (can't find) is not consistent with missing execute permissions, which would look like this:

$ touch booger
$ ./booger
zsh: permission denied: ./booger

Still, this is consistent on Mac, Linux, *BSD, and others. Since it's now confirmed working everywhere, I'm going to close this. Thanx for al that participated.

@ohmantics
Copy link

The patch in the above comment has not been integrated yet.

@gamelaster
Copy link
Member

@ohmantics it still doesn't compile?

@ohmantics
Copy link

ohmantics commented Jul 16, 2023

@ohmantics it still doesn't compile?

@gamelaster No, it still fails. The patch in the above comment needs to be hand-applied (the additional #include statement).

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

No branches or pull requests

7 participants