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

Raise error when using BUILD_FOR envvars on multi-arch and unknown builds #4314

Closed
mr-cal opened this issue Aug 11, 2023 · 2 comments · Fixed by #4332
Closed

Raise error when using BUILD_FOR envvars on multi-arch and unknown builds #4314

mr-cal opened this issue Aug 11, 2023 · 2 comments · Fixed by #4332
Assignees
Labels
enhancement New features or optimizations

Comments

@mr-cal
Copy link
Collaborator

mr-cal commented Aug 11, 2023

What needs to get done

#4313 added the following environment variables for core20 snaps:

  • SNAPCRAFT_ARCH_BUILD_ON
  • SNAPCRAFT_ARCH_TRIPLET_BUILD_ON
  • SNAPCRAFT_ARCH_BUILD_FOR
  • SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR

Multi-arch builds and builds with unknown architectures do not evaluate SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR.

When these envvars are used in a snapcraft.yaml, an error should be raised, explaining to the user why they cannot use these envvars.

Why it needs to get done

This will improve the user experience for core20 snaps, where users are allowed to build for multiple architectures and unknown architectures.

@mr-cal mr-cal added the enhancement New features or optimizations label Aug 11, 2023
@sergiusens
Copy link
Collaborator

In snapcraft.yaml

environment:
    LD_LIBRARY_PATH: /usr/lib/$SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR

Would fail if multiple build fors exist, this could also fail correctly

override-build: |
     mv lib.a $SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR/

but the following would not

override-build: |
    ./build.sh

build.sh

#!/bin/sh
mv lib.a $SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR/

nor,

parts:
    source: .
    plugin: make

Makefile,

all:
    mv lib.a $SNAPCRAFT_PART_INSTALL/usr/lib/$(SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR)/

@sergiusens
Copy link
Collaborator

always emit a warning for an empty build-for

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

Successfully merging a pull request may close this issue.

2 participants