Skip to content

Fix building the test application on non-x86 machines - #539

Open
sicherha wants to merge 1 commit into
BLAKE3-team:masterfrom
sicherha:fix_test_on_non-x86_machines
Open

Fix building the test application on non-x86 machines#539
sicherha wants to merge 1 commit into
BLAKE3-team:masterfrom
sicherha:fix_test_on_non-x86_machines

Conversation

@sicherha

@sicherha sicherha commented Jan 9, 2026

Copy link
Copy Markdown

I maintain the Fedora Linux package for the blake3 C library.

On anything other than x86, make -f Makefile.testing fails due to undefined symbols:

/usr/bin/ld: /tmp/ccojePfa.o: in function `main':
main.c:(.text.startup+0x758): undefined reference to `get_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0x75c): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0x760): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0xcfc): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0xd00): undefined reference to
`g_cpu_features'
collect2: error: ld returned 1 exit status
make: *** [Makefile.testing:50: all] Error 1

The regression was introduced by commit
34d293e.

Here is how the two affected symbols, g_cpu_features and get_cpu_features(), are used in the different configurations.

IS_X86 BLAKE3_TESTING Use of symbols
X internal
X X internal & external
N/A
X external

On anything other than x86, `make -f Makefile.testing` fails due to
undefined symbols:
```
/usr/bin/ld: /tmp/ccojePfa.o: in function `main':
main.c:(.text.startup+0x758): undefined reference to `get_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0x75c): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0x760): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0xcfc): undefined reference to
`g_cpu_features'
/usr/bin/ld: main.c:(.text.startup+0xd00): undefined reference to
`g_cpu_features'
collect2: error: ld returned 1 exit status
make: *** [Makefile.testing:50: all] Error 1
```

The regression was introduced by commit
34d293e.

Here is how the two affected symbols, `g_cpu_features` and
`get_cpu_features()`, are used in the different configurations.

| `IS_X86` | `BLAKE3_TESTING` | Use of symbols      |
| :------: | :--------------: | ------------------- |
| X        |                  | internal            |
| X        | X                | internal & external |
|          |                  | N/A                 |
|          | X                | external            |
@oconnor663

oconnor663 commented Jan 9, 2026

Copy link
Copy Markdown
Member

Thanks for the detailed report, particularly the responsible commit. This change looks reasonable. The bigger question to me is whether we want to add Makefile.testing to CI or just remove it. @BurningEnlightenment the same test.py file is now exercised by the cmake_c_tests CI job, correct? I should admit that when I'm working on the C code, my personal workflow is usually cd c/blake3_c_rust_bindings && cargo test.

@BurningEnlightenment

Copy link
Copy Markdown
Collaborator

yes, CMake executes test.py as part of cmake_c_tests. So removing Makefile.testing wouldn't reduce coverage. On that note, I still need to refactor and integrate #472

gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Feb 22, 2026
Apply patch to fix linking of the test executable on non-x86 based
platforms.

Link: BLAKE3-team/BLAKE3#539
Closes: https://bugs.gentoo.org/970424
Reported-by: Eli Schwartz <eschwartz@gentoo.org>
Suggested-by: Christoph Erhardt <github@sicherha.de>
Signed-off-by: Brett A C Sheffield <bacs@librecast.net>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/112
Merges: https://codeberg.org/gentoo/gentoo/pulls/112
Signed-off-by: Sam James <sam@gentoo.org>
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