Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kzantow
Copy link
Contributor

@kzantow kzantow commented Aug 17, 2022

This PR adds support for building and testing Syft using make on macOS with ARM-based processors, predominantly by upgrading base images which include arm support.

Signed-off-by: Keith Zantow <[email protected]>
@kzantow kzantow force-pushed the support-building-macos-arm branch from ae00ef5 to c198587 Compare August 17, 2022 17:33
@kzantow kzantow marked this pull request as ready for review August 17, 2022 21:24
@kzantow kzantow requested a review from a team August 17, 2022 21:25
@spiffcs
Copy link
Contributor

spiffcs commented Aug 22, 2022

@tgerla I think you're the only other person with an M1 mac currently that I know that could test this. If anyone in the community has one and can validate these changes then that would be great!

@@ -1,3 +1,5 @@
//go:build !arm64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -1,4 +1,4 @@
FROM jenkins:2.60.3
FROM jenkins/jenkins:2.346.3-slim-jdk17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update here - was this causing an issue on macOS ARM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there were no arm images prior to this version, or at least... this version works with our tests and provides arm images :)

@spiffcs
Copy link
Contributor

spiffcs commented Aug 22, 2022

confirmed that these Makefile changes are still backwards compatible on non macOS ARM platforms and do not change development workflows besides enhancing compatibility

@tgerla
Copy link
Contributor

tgerla commented Aug 22, 2022

This is working fine for me on my M1 Mac. The only thing that fails is the build step that generates a .deb. It looks like some sort of architecture mismatch. Maybe that amd64 deb build can be skipped on arm64 configurations?

(full build log: https://gist.github.com/tgerla/4e986e37eadcefeb1dea8742f25c8b45)

+ docker run --rm -v /var/run/docker.sock://var/run/docker.sock -v //Users/tgerla/git/anchore/syft:/src -v /var/folders/n2/7zlrwfws2q15lkc4pc8tfr080000gn/T/syft-acceptance-test-deb-XXXXXX.PhRt4woq:/var/folders/n2/7zlrwfws2q15lkc4pc8tfr080000gn/T/syft-acceptance-test-deb-XXXXXX.PhRt4woq -e SYFT_CHECK_FOR_APP_UPDATE=0 -w /src ubuntu:latest /bin/bash -x -c '            DEBIAN_FRONTEND=noninteractive apt install ./snapshot/syft_*_linux_amd64.deb -y &&             syft version &&             syft packages centos:8.2.2004 -vv -o json > /var/folders/n2/7zlrwfws2q15lkc4pc8tfr080000gn/T/syft-acceptance-test-deb-XXXXXX.PhRt4woq/acceptance-deb-centos-8.2.2004.json         '
+ DEBIAN_FRONTEND=noninteractive
+ apt install ./snapshot/syft_0.41.3-SNAPSHOT-aa82f55_linux_amd64.deb -y

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  syft:amd64
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/21.3 MB of archives.
After this operation, 60.0 MB of additional disk space will be used.
Get:1 /src/snapshot/syft_0.41.3-SNAPSHOT-aa82f55_linux_amd64.deb syft amd64 0.41.3~SNAPSHOT-aa82f55 [21.3 MB]
debconf: delaying package configuration, since apt-utils is not installed
dpkg: error processing archive /src/snapshot/syft_0.41.3-SNAPSHOT-aa82f55_linux_amd64.deb (--unpack):
 package architecture (amd64) does not match system (arm64)
Errors were encountered while processing:
 /src/snapshot/syft_0.41.3-SNAPSHOT-aa82f55_linux_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
+ cleanup
+ exit_code=100
+ rm -rf /var/folders/n2/7zlrwfws2q15lkc4pc8tfr080000gn/T/syft-acceptance-test-deb-XXXXXX.PhRt4woq
+ exit 100
make: *** [compare-test-deb-package-install] Error 100

@spiffcs
Copy link
Contributor

spiffcs commented Aug 24, 2022

I think all that's needed here is to resolve the Makefile conflicts. We can address @tgerla's comment in a separate PR since I think there is a non-obvious way to skip/fix that check on the m2

@spiffcs
Copy link
Contributor

spiffcs commented Aug 24, 2022

TBD - exclusion/fix of build to resolve: https://gist.github.com/tgerla/4e986e37eadcefeb1dea8742f25c8b45

@spiffcs spiffcs changed the title Support building on macOS ARM enhance development support on macOS ARM Aug 24, 2022
@spiffcs spiffcs merged commit 7d4f333 into anchore:main Aug 24, 2022
@kzantow kzantow deleted the support-building-macos-arm branch August 24, 2022 17:55
spiffcs added a commit that referenced this pull request Aug 25, 2022
* main:
  Update syft bootstrap tools to latest versions. (#1176)
  enhance development support on macOS ARM (#1163)
  Capture if a node module is private (#1161)
  Find version numbers from jars with different naming conventions (#1174)
  Update syft bootstrap tools to latest versions. (#1171)
  Fix update-bootstrap-tools workflow (#1170)
  workflow to create automated PRs to update bootstrap tools (#1167)
  feat: add support for licenses in package-lock json v2 (#1164)
  External sources configuration (#1158)
  feat: add support for pnpm (#1166)
  Prevent symlinks causing duplicate package-file relationships (#1168)
  Associate node package licenses from node_modules (#1152)
aiwantaozi pushed a commit to aiwantaozi/syft that referenced this pull request Oct 20, 2022
spiffcs pushed a commit that referenced this pull request Oct 21, 2022
spiffcs pushed a commit that referenced this pull request Oct 21, 2022
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants