boschrexroth / ctrlx-automation-sdk

ctrlX AUTOMATION Software Development Kit
https://boschrexroth.github.io/ctrlx-automation-sdk/
Other
69 stars 24 forks source link

Build Apps for CtrlX3 and GLIBC 2.39 #42

Closed lupaulus closed 6 months ago

lupaulus commented 6 months ago

Hey,

How can I adapt this lines to build on Raspabian ? Because apt update failed to retrieve this packages.

sudo dpkg --add-architecture arm64

DIST="$(lsb_release -sc)"
sudo echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DIST} main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/multiarch-libs.list
sudo echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DIST}-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/multiarch-libs.list
sudo echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DIST}-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/multiarch-libs.list
sudo echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DIST}-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/multiarch-libs.list

# Qualify architecture
sudo sed -i 's/deb http:/deb [arch=amd64] http:/g' /etc/apt/sources.list
Wishmaster-de commented 6 months ago

@lupaulus

  1. Are you using the 64bit Version of Rasbian? 'uname -a' should help you
  2. Which Pi are you using? The Pi architecture should be arm64/aarch64

So i think you don't have to add the arm64 architecture.

lupaulus commented 6 months ago

The error when I build with snapcraft :

uname -a output (aarch64) :

Linux  6.6.28+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux 

Model Name : Raspberry Model PI 4 B

Wishmaster-de commented 6 months ago

The error when I build with snapcraft : image

uname -a output (aarch64) :

Linux  6.6.28+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux 

Model Name : Raspberry Model PI 4 B

You don't have to add the architecture. You can install all packages for the arm64 architecture for building for arm64. The datalayer debian packet includes amd64 (PC) and the arm64 version.

For which architecture are building the project?

lupaulus commented 6 months ago

I'm building for arm64 (CtrlX3 target).

I will try, but why I have this error then when I have all dependencies : image

Wishmaster-de commented 6 months ago

Could you please provide more information:

lupaulus commented 6 months ago

Do you want to create a snap for a example project from the sdk? If yes, which one?

No, from your local project, by my colleague it is working successfully

Which commands do you execute to build and pack the snap?

#!/usr/bin/env bash
set -e
snapcraft clean --destructive-mode
snapcraft --destructive-mode --target-arch=arm64 --enable-experimental-target-arch

Which ctrlx-automation-sdk version are you using?

ctrlx-automation-sdk github clone from 08/05/2024

lupaulus commented 6 months ago

Can we get in Touch ?

Wishmaster-de commented 6 months ago

Do you want to create a snap for a example project from the sdk? If yes, which one?

No, from your local project, by my colleague it is working successfully

I' am a little bit confused. Do you want to build a snap from an example from the ctrlx automation sdk or do you have a project of your own?

Which commands do you execute to build and pack the snap?

#!/usr/bin/env bash
set -e
snapcraft clean --destructive-mode
snapcraft --destructive-mode --target-arch=arm64 --enable-experimental-target-arch

Which ctrlx-automation-sdk version are you using?

ctrlx-automation-sdk github clone from 08/05/2024

This ctrlx automation sdk is based on Ubuntu core 22. Your syntax is deprecated and will not work for core22. You need to use: snapcraft pack --build-for=arm64 --verbose The --verbose should give you more information in which step the pack process is failing.

Can you share more information of your project? Maybe your snapcraft.yaml?

lupaulus commented 6 months ago

I' am a little bit confused. Do you want to build a snap from an example from the ctrlx automation sdk or do you have a project of your own?

It's an own project, that we started building from your example; targetting Ctrlx3 2.2.X

This ctrlx automation sdk is based on Ubuntu core 22. Your syntax is deprecated and will not work for core22.

Ok, but it is in your sample ... ctrlx-automation-sdk/samples-python/webserver /build-snap-arm64.sh

image

snapcraft.yaml :

base: core22
confinement: strict
grade: stable

apps:
  linckdc:
    command: bin/linckdc
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  publisher:
    command: bin/publisher
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  web:
    command: bin/web
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  simulation:
    command: bin/simulation
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

parts:
  linckdc:
    plugin: python
    source: .
    stage-packages:
      - libzmq5
      - ctrlx-datalayer
  publisher:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  web:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  simulation:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  helper:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  config:
    plugin: dump
    source: ./config
    organize:
      '*': ./config/
      '.*': ./config/
  configs:
    plugin: dump
    source: ./configs
    organize:
      'package-assets/*': package-assets/${SNAPCRAFT_PROJECT_NAME}/

plugs:
  datalayer:
    interface: content
    content: datalayer
    target: $SNAP_DATA/.datalayer
  active-solution:
    interface: content
    content: solutions
    target: $SNAP_COMMON/solutions

hooks:
  connect-plug-active-solution:
    plugs: [active-solution]
  remove:
    plugs: [active-solution]

slots:
  package-assets:
    interface: content
    content: package-assets
    source:
      read:
      - $SNAP/package-assets/${SNAPCRAFT_PROJECT_NAME}
  package-run:
    interface: content
    content: package-run
    source:
      write:
      - $SNAP_DATA/package-run/${SNAPCRAFT_PROJECT_NAME}
lupaulus commented 6 months ago

I switched on Ubuntu 24.04

ldd --version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.1) 2.39
Wishmaster-de commented 6 months ago

I' am a little bit confused. Do you want to build a snap from an example from the ctrlx automation sdk or do you have a project of your own?

It's an own project, that we started building from your example; targetting Ctrlx3 2.2.X

OK. You are using python. I am not an employee of Bosch Rexroth. I thought i could help you as a community member. ;-) I have no experience with python concerning python projects on Ctrlx. I am using mostly c++ and angular. And i am building the c++ projects for amd64 and arm64 (crossbuild).

This ctrlx automation sdk is based on Ubuntu core 22. Your syntax is deprecated and will not work for core22.

Ok, but it is in your sample ... ctrlx-automation-sdk/samples-python/webserver /build-snap-arm64.sh

image

Maybe this was forgotten while upgrading to core22. In c++ projects with core22 i was not able to use --target-arch=arm64 --enable-experimental-target-arch

snapcraft.yaml :

base: core22
confinement: strict
grade: stable

apps:
  linckdc:
    command: bin/linckdc
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  publisher:
    command: bin/publisher
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  web:
    command: bin/web
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

  simulation:
    command: bin/simulation
    plugs:
      - network
      - network-bind
      - datalayer
      - active-solution
    daemon: simple
    passthrough:
      restart-condition: always
      restart-delay: 30s

parts:
  linckdc:
    plugin: python
    source: .
    stage-packages:
      - libzmq5
      - ctrlx-datalayer
  publisher:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  web:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  simulation:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  helper:
    plugin: python
    source: .
    stage:
      - -lib/python3.*/site-packages/*
      - -bin/*
      - -pyvenv.cfg
  config:
    plugin: dump
    source: ./config
    organize:
      '*': ./config/
      '.*': ./config/
  configs:
    plugin: dump
    source: ./configs
    organize:
      'package-assets/*': package-assets/${SNAPCRAFT_PROJECT_NAME}/

plugs:
  datalayer:
    interface: content
    content: datalayer
    target: $SNAP_DATA/.datalayer
  active-solution:
    interface: content
    content: solutions
    target: $SNAP_COMMON/solutions

hooks:
  connect-plug-active-solution:
    plugs: [active-solution]
  remove:
    plugs: [active-solution]

slots:
  package-assets:
    interface: content
    content: package-assets
    source:
      read:
      - $SNAP/package-assets/${SNAPCRAFT_PROJECT_NAME}
  package-run:
    interface: content
    content: package-run
    source:
      write:
      - $SNAP_DATA/package-run/${SNAPCRAFT_PROJECT_NAME}
Wishmaster-de commented 6 months ago

I switched on Ubuntu 24.04

ldd --version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.1) 2.39

Hm, maybe a version problem

I'm building for arm64 (CtrlX3 target).

I will try, but why I have this error then when I have all dependencies : image

Here GLIBC2.36 and the other GLIBC 2.39.

albrecht-j commented 6 months ago

Hi @lupaulus i think also that is a Version Problem. If you want to build a snap for CORE X3 Version 2.x you have to build on an Ubuntu Version 22.

Have you tried this?

lupaulus commented 6 months ago

No, I will try.

Thanks for the support

albrecht-j commented 6 months ago

Okay, thanks.

Please let us know :)

lupaulus commented 6 months ago

@albrecht-j No warning with Ubuntu 22.04 LTS for raspberry and glibc 2.35