Solar2D Linux
Solar2D Linux
- raspi4 - debian 12(raspi os/bookworm) gcc-12 clang-14
- jetson - ubuntu 20.04 Focal (skip because of gcc-9)
- raspi5 - ubuntu 22.04 Jammy gcc-11, kernel is build with gcc-12
ubuntu 22.10 kinetic
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/releases
ubuntu 22.08 (Kinetic): Based on Debian 12 (Bookworm) GNOME 43
/Users/ymmtny/Documents/work/Solar2DTux/
platform/linux/Solar2DBuilder/test
hello
../linux/bin/Solar2DBuilder build --lua "args_arm.lua"
local params = { platform='linux', arch = 'arm', -- armhf, arm64, x86_64, amd64 appName='hello', appVersion='1.0', dstPath='.', projectPath='./HelloWorld', linuxtemplate='../linux/bin/Resources/template_arm.tgz', } return params
platform/linux/buildx
build.sh
docker run --rm --name builder -it -v $(pwd):/solar2d -v ¥ $(pwd)/platform/linux/buildx/entrypoint.sh:/entrypoint.sh ¥ --entrypoint /entrypoint.sh ¥ --platform linux/arm64 gcc:12-bookworm
entorypoint.sh
cd /solar2d/platform/linux sh ./setup_dev.sh sh ./setup_build.sh
setup_dev.sh
apt-get install -y cmake ... aput-get install -y temurin-8-jdk temurin-8-jre ... git clone https://git.launchpad.net/ubuntu/+source/readline git checkout -b debian/stretch origin/debian/stretch ... wget wxurl=https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/wxWidgets-3.1.4.tar.bz2 ...
setup_build.sh
- build gtk
- git clone Solar2D
- build Solar2D
objdump -p /usr/local/bin/Solar2D/Solar2DSimulator | grep NEEDED
NEEDED libGL.so.1 NEEDED libz.so.1 NEEDED libopenal.so.1 NEEDED libfreetype.so.6 NEEDED libpng16.so.16 NEEDED libjpeg.so.62 NEEDED libcrypto.so.3 NEEDED libcurl.so.4 NEEDED libSDL2-2.0.so.0 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libc.so.6
snap
cp -R platform/linux/snapcraft/snap_arm64 /solar2d/snap
bookworm uses wayland. raspi-config > Advanced to swich X11
sudo raspi-config nonint do_wayland W1
https://qiita.com/ktamido/items/82ed2f5bd324d4721096 バージョン0.7.0以降の WayVNC は RealVNC と互換性のある RSA-AES 認証が追加されたらしく、適切な証明書を生成すると、RealVNCから接続できる
https://docs.cse.lehigh.edu/xforwarding/xforwarding-mac/ https://stackoverflow.com/questions/65468655/vs-code-remote-x11-cant-get-display-while-connecting-to-remote-server
sudo apt update
sudo apt install x11-apps
java 8
AppImage
https://github.com/ANSH3LL/solar2d-appimage/tree/main
./Solar2D-x86_64.AppImage builder [options] ./Solar2D-x86_64.AppImage simulator ./Solar2D-x86_64.AppImage execute /path/to/main.lua ./Solar2D-x86_64.AppImage
https://github.com/DanS2D/Solar2DTux-AppImageWIPStuff/tree/master
snap
error
pi@kwiksher-solar2d:~/projects/deploy-solar2d $ snap run --strace solar2d
/snap/strace-static/current/bin/strace: Cannot find user 'pi'
https://snapcraft.io/docs/environment-variables
snap run --shell <snap>.<command>
snap connections --all
snap info --verbose vlc
sudo apt update
sudo apt install snapd
sudo reboot
sudo snap install core
snap install hello-world
sudo snap install snapcraft --classic
sudo snap install lxd --channel=latest/stable
sudo snap remove –purge lxd
https://stackoverflow.com/questions/57525289/not-able-to-execute-lxd-lxc-commands-as-sudo
newgrp lxd
sudo usermod -aG pi lxd
lxd init --minimal
snapcraft --use-lxd
sudo usermod -aG ymmtny lxd
sudo gpasswd lxd
snap install opy_latest_amd64.snap --dangerous
unsquashfs <file>.snap
sudo apt update
ln -s ../sysroot sysroot
snap remove --purge lxd
lxd init --minimal
snapcraft --use-lxd
snapcraft prime --shell-after --use-lxd
snapcraft clean
lxc ls
lxc container
lxc delete {name}
snap install solar2d_2100.9999_arm64.snap --dangerous --devmode
snap connections --all
https://snapcraft.io/docs/debug-snaps
sudo snap install strace-static snap run --strace <snap-name> sudo snap install snappy-debug sudo snappy-debug <snap-name> sudo journalctl --output=short --follow --all | sudo snappy-debug
https://snapcraft.io/docs/c-c-applications
$SNAPCRAFT_ARCH_TRIPLET
environment: "LD_LIBRARY_PATH": "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio" "DISABLE_WAYLAND": "1"
https://snapcraft.io/docs/snapcraft-extensions
snapcraft extension gnome-3-28
apps: firefox: command: firefox command-chain: [tmpdir] desktop: distribution/firefox.desktop extensions: [gnome-3-34] layout: /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0: bind: $SNAP/gnome-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkit2gtk-4.0
gnome-3-38
https://snapcraft.io/docs/build-and-staging-dependencies
environment: LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib
The shorthand format will also produce the same result:
```
architectures:
- amd64
```
https://snapcraft.io/docs/defining-a-command
apps: part-os-release: command: bin/os-release.sh parts: part-os-release: plugin: dump source: . organize: os-release.sh: bin/
https://snapcraft.io/docs/iterating-over-a-build
snapcraft prime --shell snapcraft prime --shell-after snapcraft clean snapcraft build --shell
https://mir-server.io/docs/packaging-an-x11-application-as-an-iot-gui ⭐️
sudo ifconfig usb0 down for windows with raspi4 type-c
Solar2D/platform/linux/gh_action.sh
sudo snap install snapcraft --classic sudo snap install lxd --channel=latest/stable >sudo snap remove --purge lxd sudo lxd init --minimal ... ... sudo snapcraft --use-lxd
https://snapcraft.io/docs/installing-snap-on-raspbian
adb
- https://snapcraft.io/install/android-adb/raspbian
- https://qiita.com/nekoaddict/items/0a167c364bf40e91f5e0
/Solar2D/platform/linux/snapcraft/snap/snapcraft.yaml
base: core20 architectures: - amd64 layout: /usr/bin/keytool: symlink: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/bin/keytool /usr/bin/jarsigner: symlink: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner /usr/bin/java: symlink: $SNAP/usr/lib/jvm/java-8-openjdk-amd64/bin/java parts: readline: source: http://mirrors.kernel.org/ubuntu/pool/main/r/readline/libreadline7_7.0-3_amd64.deb plugin: dump source-type: deb
https://forum.snapcraft.io/t/how-to-execute-a-binary-file-inside-a-snap/34342/13
everything (binary and libraries) is inside release/,
apps: examplebin: command: mybinary environment: LD_LIBRARY_PATH: $SNAP/release:$SNAP/lib/x86_64-linux-gnu parts: examplebin: plugin: dump source: release
sudo snap install opy_latest_amd64.snap --dangerous
Can I use snapcraft with LXD on macOS? - answered by bard
No, directly using Snapcraft with LXD on macOS isn't possible. Here's the breakdown: LXD limitations: macOS itself doesn't have built-in LXD support. LXD relies on functionalities offered by the Linux kernel, which macOS lacks. Snapcraft on macOS: While Snapcraft itself can run on macOS, it's limited to store-related operations. It cannot build snaps directly due to the missing Linux environment. There are alternative approaches to consider: Remote LXD instance: You can point Snapcraft to a remote LXD instance running on a Linux machine. This allows leveraging LXD for building while using your macOS machine for development. Tools like "cleanbuild" can facilitate this setup. Multipass: Snapcraft defaults to using Multipass (a lightweight Ubuntu virtualization solution) on macOS for building snaps. This provides a Linux environment for the build process within macOS. If you're comfortable with virtualization, using Multipass might be a simpler solution for building snaps on your macOS machine.
Here are some alternative approaches: Build with LXD: If you're on Raspberry Pi itself, consider using LXD for building snaps. This ensures the snap targets the Raspberry Pi's architecture from the get-go. Multipass workaround (advanced): There are complex workarounds involving creating a custom cloud image for Multipass that matches Raspberry Pi's architecture. This approach is not recommended for beginners due to its involved nature. You can search for "Multipass Raspberry Pi cloud image" for more information if you're interested. For most scenarios, building with LXD directly on your Raspberry Pi is the recommended approach for ensuring compatibility with the target platform.
flatpak
flatpak run --command=sh --devel <application-id>
https://davejansen.com/give-full-filesystem-access-to-flatpak-installed-applications/
sudo flatpak override fr.handbrake.ghb --filesystem=home
https://docs.flatpak.org/en/latest/basic-concepts.html
https://docs.flatpak.org/en/latest/sandbox-permissions.html
–share=network
–socket=fallback-x11
–share=ipc
–device=dri
OpenGL rendering
–socket=pulseaudio
–filesystem=home
Flatpak app inside Docker fails with: Could not connect: No such file or directory
dbus-send --system /org/freedesktop/DBus org.freedesktop.DBus || dbus-daemon --system --fork
gh_action_flatpak
sudo apt install flatpak -y # Add the Flathub repository sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo sudo flatpak install flathub org.flatpak.Builder -y sudo flatpak install flathub org.freedesktop.Platform//21.08 -y sudo flatpak install org.freedesktop.Sdk//21.08 -y # build flat app and put it in a repo flatpak run org.flatpak.Builder --disable-rofiles-fuse --force-clean --repo repo build-dir "${YML}" # Create a single-file bundle from a local repository flatpak build-bundle ./repo solar2d.flatpak com.solar2d.simulator flatpak --user install app.flatpak flatpak run com.solar2d.simulator
https://flatpak.org/setup/Raspberry%20Pi%20OS
runtime-version: '21.08'
Document how to cross-compile
flatpak-builder --arch=aarch64
https://www.reddit.com/r/Fedora/comments/tpsret/how_can_i_force_flatpak_apps_to_run_on_wayland/
–socket=fallback-x11
flatpak run –socket=wayland
flatseal
https://www.reddit.com/r/linux/comments/ymth3a/flatseal_is_incredible_its_a_gui_that_let_you/
wsl
https://www.reddit.com/r/flatpak/comments/15for23/can_flatkpak_be_run_on_wsl2/
sudo service dbus start
export DISPLAY=localhost:0.0
mesa
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/wikis/Mesa-git
Raspberry Pi OSでGNOME Desktopを使う https://qiita.com/kniwase/items/bb881771cecf2ae50265
raspi-configから増量する Performance Options -> P2 GPU Memory 4GBモデルなら256MB, 8GBモデルなら512MBあたりが無難
deb
Solar2D/platform/resources/linuxPackageApp.lua
clang
aj@raspberrypi:~ $ clang++-13 --version Debian clang version 13.0.1-6~deb11u1 Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin aj@raspberrypi:~ $ lld-link-13 --version Debian LLD 13.0.1 aj@raspberrypi:~ $ ldd --version ldd (Debian GLIBC 2.31-13+rpt2+rpi1+deb11u5) 2.31
aj@andys-mbp ~/Code/cross-clang-rpi4 $ clang++ --version Apple clang version 14.0.3 (clang-1403.0.22.14.1) Target: arm64-apple-darwin22.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin aj@andys-mbp ~/Code/cross-clang-rpi4 $ ld --version Homebrew LLD 14.0.6 (compatible with GNU linkers) aj@andys-mbp ~/Code/cross-clang-rpi4 $ cmake --version cmake version 3.26.3
- mac clang LLVM clang-19をソースコードからビルド https://qiita.com/kyamaz/items/72bb8a536ac80355d658
docker buildx
https://www.docker.com/blog/how-to-rapidly-build-multi-architecture-images-with-buildx/
⭐️ https://thecurve.io/building-for-arm-with-docker-packaging-libcamera-apps-for-alpine-on-armv7/
Distroless
https://blog.inductor.me/entry/alpine-not-recommended
- https://www.innoq.com/en/blog/2023/02/how-to-use-and-build-your-own-distroless-images/ no shell, no package managers or other debug tools
https://zenn.dev/yoshii0110/articles/21ddb58c6f6bfa
- debian-slim based
- alpine-based
RaspberryPi OSのDockerイメージを使ってCI環境構築 - github action
techlife/raspios_lite_armhf:2022-09-06_bullseye
debian ubuntu
https://pc.watch.impress.co.jp/docs/column/ubuntu/1512815.html
https://pc.watch.impress.co.jp/docs/column/ubuntu/1531425.html
- 使い慣れたデスクトップ/サーバーと同じOSが使える
- 最新のUbuntuのリリースが使える(Raspberry Pi OSは2023年9月時点で、まだ最新のDebian 12に追従できていない)
- snapパッケージシステムがデフォルトで動く
- LTSならば延長サポート込みで10年利用できる
jetson nano
Hardware codec encoder is not available in orin nano. This makes the new one much worse than the older one when streaming from a camera.
carrier board is not available in the orin series.
price tag is way more than the original $100.
gcc
The Bullseye default compiler is gcc 10, with Bookworm it’s gcc 12. clang-13 the latest clang release on Bullseye, clang-15 the latest on Bookworm.
binutil 2.39 for gcc-12.2.0
http://blog.kmckk.com/archives/5774305.html
GCC の場合、ホストの C++ コンパイラのみ(通常は GCC)で、Binutils と GCC のソースコードから完全な C/C++ クロスコンパイラをビルドすることが可能 リンカのみ Binutils の GNU ld compiler-rt などをビルドする際に -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY を指定
C++11 thread など使う場合は現状 pthread 必須ですから(Posix 環境の場合), だいたい現在のナウでヤングな C++11 or later コードでは -pthread 必須 優秀な aarch64 + C/C++ 開発若人さまが, clang + cmake で aarch64 クロスコンパイル環境を整えることで, 人類史上最速で究極の aarch64 + C/C++ 開発若人さまへと昇華なされるスキームを確立
https://packages.ubuntu.com/search?keywords=clang
jammy (22.04LTS) 14.0
https://gnutoolchains.com/raspberry/
- 12.2.0 2023-10-10-raspios-bookworm
- 10.2.1 2023-05-03-raspios-bullseye
22.04, the default GNU C compiler version is gcc-11
update to Ubuntu 22.04, and then apt install g++-12.
kwiksher-solar2d.loca
/Users/ymmtny/Documents/GitHub/making-iot/Koi/doc/setup_memo_raspi_yolo.md
/Users/ymmtny/Documents/GitHub/AI-RC/backup
- cmdline.txt
- config.txt
- firstrun.sh
otg_mode=1
dtoverlay=dwc2
#dtoverlay=disable-wifi
modules-load=dwc2,g_ether
first_run.sh, Before the rm … command, add this:
```
cat << EOF > /etc/network/interfaces.d/usb0
auto usb0
allow-hotplug usb0
iface usb0 inet static
address 192.168.2.2
netmask 255.255.255.0
gateway 192.168.2.1
EOF
```
