toradex / vscode-torizon-templates

VS Code Torizon Integrated Development Environment Templates
MIT License
14 stars 20 forks source link

C++/Makefile template devDeps does not work for target libraries #185

Closed drewmoseley closed 2 days ago

drewmoseley commented 5 months ago

I am trying to link with a target library (libtirpc3). If I add "libtirpc-dev" to devDeps in torizonPackages.json the build will install the architecture matching my host (x86_64). If I explicitly use "libtirpc-dev:arm64" the build fails with:

4.563 E: Unable to locate package libtirpc-dev:arm64:
------
Dockerfile.sdk:31
--------------------
  30 |     # automate for torizonPackages.json
  31 | >>> RUN apt-get -q -y update && \
  32 | >>>     apt-get -q -y install \
  33 | >>> # DO NOT REMOVE THIS LABEL: this is used for VS Code automation
  34 | >>>     # __torizon_packages_dev_start__
  35 | >>>      rpcsvc-proto: \
  36 | >>>      libtirpc-dev:arm64: \
  37 | >>>      cpp: \
  38 | >>>     # __torizon_packages_dev_end__
  39 | >>> # DO NOT REMOVE THIS LABEL: this is used for VS Code automation
  40 | >>>     && \
  41 | >>>     apt-get clean && apt-get autoremove && \
  42 | >>>     rm -rf /var/lib/apt/lists/*
  43 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get -q -y update &&     apt-get -q -y install \trpcsvc-proto: \tlibtirpc-dev:arm64: \tcpp:     &&     apt-get clean && apt-get autoremove &&     rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100
drewmoseley commented 5 months ago

It seems we are adding a ":" at the end of all the packages unconditionally but maybe this should only be done if an arch is not already specified for any given package.

drewmoseley commented 5 months ago

Workaround for anyone who may be having this issue: Manually edit Dockerfile.sdk and add the arch-based package name outside of the VSCode-automation bits.

drewmoseley commented 5 months ago

Also, I suspect this is true of other templates but have not tested that.

andreriesco commented 4 months ago

This happens because the devDeps adds the packages to Dockerfile.debug and Dockerfile.sdk. But as the Dockerfile.sdk is a x86 container that compiles the code through cross-compilation this error happens. We should add an extra field like sdkDeps to separate the packages installed on the Dockerfile.debug and on the Dockerfile.sdk

microhobby commented 4 days ago

@andreriesco I believe that this was fixed in next, right? If so, please close this one.

andreriesco commented 2 days ago

Yes, by this commit here. I will close it here, thanks for the reminder.