canselcik / libremarkable

The only public framework for developing applications with native refresh support for Remarkable Tablet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macOS installation problems

Gozala opened this issue · comments

Hi,

Thanks for all the work you've put into this project, I am really excited to try and see what would it enable me to do!

Sadly I have not got far. I have encountered bunch of problems installing toolchain from
https://remarkable.engineering/deploy/sdk/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-2.1.3.sh

BTW https://remarkable.engineering/ seems to link to this one instead https://remarkable.engineering/oecore-x86_64-cortexa9hf-neon-toolchain-zero-gravitas-1.8-23.9.2019.sh (should I be using one above or things have changed in the meantime ?)

With the poky-glibc-* toolchain on macOS 10.15.5 I've run with following problems:

  1. readlink -m causes illegal option -- m error.
    • I did worked around it via installing brew install coreutils and creating symlinking greadlink to readlink in my PATH.
  2. Once I got passed issue above I've started having tar: Option --checkpoint=.2500 is not supported
    • Was able to workaround it via brew install gnu-tar and symlinking gtar to tar in my PATH.
    • However my PATH was not taken into account by toolchain script, but setting ENVCLEANED=0 solved that.
  3. Now I'm stuck on find: -printf: unknown primary or operator.

Current output I get is following:

ENVCLEANED=0 ~/Downloads/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-2.1.3.sh -D
Poky (Yocto Project Reference Distro) SDK installer version 2.1.3
=================================================================
+ '[' '' = 1 ']'
+ '[' '' = '' ']'
+ '[' '' = Y ']'
+ read -p 'Enter target directory for SDK (default: /opt/poky/2.1.3): ' target_sdk_dir
Enter target directory for SDK (default: /opt/poky/2.1.3):
+ '[' '' = '' ']'
+ target_sdk_dir=/opt/poky/2.1.3
++ echo /opt/poky/2.1.3
++ sed 's/ /\\ /g'
+ eval target_sdk_dir=/opt/poky/2.1.3
++ target_sdk_dir=/opt/poky/2.1.3
+ '[' -d /opt/poky/2.1.3 ']'
++ cd /opt/poky/2.1.3
++ pwd
+ target_sdk_dir=/opt/poky/2.1.3
+ '[' 15 -gt 2048 ']'
+ '[' '' = 1 ']'
++ echo /opt/poky/2.1.3
++ grep ' '
+ '[' -n '' ']'
+ '[' -e /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi ']'
+ echo 'The directory "/opt/poky/2.1.3" already contains a SDK for this architecture.'
The directory "/opt/poky/2.1.3" already contains a SDK for this architecture.
+ printf 'If you continue, existing files will be overwritten! Proceed[y/N]? '
If you continue, existing files will be overwritten! Proceed[y/N]? + default_answer=n
+ '[' '' = '' ']'
+ read answer
y
+ '[' y = '' ']'
+ '[' y '!=' Y -a y '!=' y ']'
+ mkdir -p /opt/poky/2.1.3
+ '[' '!' -x /opt/poky/2.1.3 -o '!' -w /opt/poky/2.1.3 -o '!' -r /opt/poky/2.1.3 ']'
+ '[' '' = 1 ']'
++ which sudo
+ SUDO_EXEC=/usr/bin/sudo
+ '[' -z /usr/bin/sudo ']'
+ /usr/bin/sudo pwd
Password:
Sorry, try again.
Password:
+ '[' 0 -ne 0 ']'
+ /usr/bin/sudo mkdir -p /opt/poky/2.1.3
++ grep -na -m1 '^MARKER:$' /Users/gozala/Downloads/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-2.1.3.sh
++ cut -d: -f1
+ payload_offset=289
+ printf 'Extracting SDK...'
Extracting SDK...+ tail -n +289 /Users/gozala/Downloads/poky-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-2.1.3.sh
+ /usr/bin/sudo tar xJ -C /opt/poky/2.1.3 --checkpoint=.2500
...................................................................................+ echo done
done
+ printf 'Setting it up...'
Setting it up...+ real_env_setup_script=
++ ls /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
+ for env_setup_script in '`ls $target_sdk_dir/environment-setup-*`'
+ grep -q OECORE_NATIVE_SYSROOT= /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
+ real_env_setup_script=/opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
+ /usr/bin/sudo sed -e s:/opt/poky/2.1.3:/opt/poky/2.1.3:g -i /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
sed: -i may not be used with stdin
+ '[' -n /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi ']'
+ env_setup_script=/opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
++ /usr/bin/sudo cat /opt/poky/2.1.3/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
++ grep OECORE_NATIVE_SYSROOT=
++ cut -d= -f2
++ tr -d '"'
+ native_sysroot=/opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux
++ /usr/bin/sudo find /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/lib -name 'ld-linux*'
+ dl_path=/opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2
+ '[' /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux/lib/ld-linux-x86-64.so.2 = '' ']'
++ /usr/bin/sudo find /opt/poky/2.1.3/sysroots/x86_64-pokysdk-linux -type f '(' -perm -0100 -o -perm -0010 -o -perm -0001 ')' -printf ''\''%h/%f'\'' '
find: -printf: unknown primary or operator
+ executable_files=
++ mktemp -d
+ tdir=/var/folders/z9/g6tzrv1n2sd0h_8snr784py80000gn/T/tmp.rcORvlA7
+ '[' x/var/folders/z9/g6tzrv1n2sd0h_8snr784py80000gn/T/tmp.rcORvlA7 = x ']'
+ cat
+ /usr/bin/sudo mv /var/folders/z9/g6tzrv1n2sd0h_8snr784py80000gn/T/tmp.rcORvlA7/relocate_sdk.sh /opt/poky/2.1.3/relocate_sdk.sh
+ /usr/bin/sudo chmod 755 /opt/poky/2.1.3/relocate_sdk.sh
+ rm -rf /var/folders/z9/g6tzrv1n2sd0h_8snr784py80000gn/T/tmp.rcORvlA7
+ '[' 1 = 1 ']'
+ /usr/bin/sudo /opt/poky/2.1.3/relocate_sdk.sh
+ '[' 255 -ne 0 ']'
+ echo 'SDK could not be set up. Relocate script failed. Abort!'
SDK could not be set up. Relocate script failed. Abort!
+ exit 1

All this issues got me wondering if I'm installing a right toolchain for mac. Searching lead me to arm-linux-gnueabihf-binutils but that doesn't seem to include arm-linux-gnueabihf-gcc so it did not do it either.

Any help would be greatly appreciated.

The toolchain is meant for linux and not MacOS. Instead of playing whack-a-mole with the script, I'd suggest using the docker toolchain instead.

Thanks @Eeems.

I also just came across this article https://sigmaris.info/blog/2019/02/cross-compiling-rust-on-mac-os-for-an-arm-linux-router/

Is there any reason not to use --target=armv7-unknown-linux-musleabihf instead, which seems to be less problematic and doesn't require docker toolchain (which I have no have prior experience with) ?

You'd have to ask @canselcik

As for the docker toolchain, it shouldn't be that difficult to work with. There is already a Dockerfile in this repository, but you can also use mine as a starting point (https://github.com/Eeems/oxidize/tree/master/docker-toolchain/cargo)
You can see some samples of how to use it here: https://github.com/Eeems/oxidize/blob/master/Makefile#L27-L60

In the readme I see:

Make sure to build with lto = true otherwise musl symbols may be improperly resolved (call to mmap fails).

But not sure how do I set lto = true (sorry I'm new to systems programming & Rust)

But not sure how do I set lto = true (sorry I'm new to systems programming & Rust)

You set it in the Cargo.toml:

lto = true

@Gozala I only tried on Debian, but it might give you some hints to get it working on macOS too: #34

@Gozala is this still relevant or could this issue be closed since it has been some time?