Skip to content

Fix cross-compiling by using CMAKE_SYSTEM_PROCESSOR and respecting -march|-mcpu - #369

Merged
liulanzheng merged 2 commits into
containerd:mainfrom
chewi:cross
Jul 30, 2025
Merged

Fix cross-compiling by using CMAKE_SYSTEM_PROCESSOR and respecting -march|-mcpu#369
liulanzheng merged 2 commits into
containerd:mainfrom
chewi:cross

Conversation

@chewi

@chewi chewi commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

There is no need to check the architecture twice. Also check for arm64 (MacOS) wherever we check for aarch64 (Linux).

Packagers may specify a target system up front, which should be respected. The CRC extensions are not strictly necessary as there is a software fallback.

Otherwise, use -mcpu=native if it works (it won't when cross-compiling) or -mcpu=generic+crc.

See also alibaba/PhotonLibOS#904.

chewi added 2 commits July 28, 2025 10:17
There is no need to check the architecture twice. Also check for arm64
(MacOS) wherever we check for aarch64 (Linux).

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Packagers may specify a target system up front, which should be
respected. The CRC extensions are not strictly necessary as there is a
software fallback.

Otherwise, use -mcpu=native if it works (it won't when cross-compiling)
or -mcpu=generic+crc.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
@chewi chewi changed the title Cross Fix cross-compiling by using CMAKE_SYSTEM_PROCESSOR and respecting -march|-mcpu Jul 28, 2025

@liulanzheng liulanzheng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@liulanzheng
liulanzheng merged commit be49fd6 into containerd:main Jul 30, 2025
2 checks passed
@chewi
chewi deleted the cross branch January 2, 2026 13:16
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.

2 participants