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

Undefined reference to roundeven functions #1205

Open
mbsmith opened this issue Aug 12, 2024 · 2 comments
Open

Undefined reference to roundeven functions #1205

mbsmith opened this issue Aug 12, 2024 · 2 comments

Comments

@mbsmith
Copy link

mbsmith commented Aug 12, 2024

I did a little poking around and didn't find the source of this issue. It seems like it should be using the gcc builtins for this, but instead are looking to musl which doesn't implement those at the moment. I did at least verify that this gcc version has those builtins via __has_builtin.

Compiler: GCC 14.2.0
Libc: Musl 1.2.5
test command: meson test --no-rebuild --print-errorlogs -C output

ninja: job failed: gcc  -o test/arm/neon/rndn-native-c test/arm/neon/rndn-native-c.p/rndn.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs -Os -fstack-clash-protection -Wformat -Werror=format-security -fno-plt -lm
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndnq_f64':
rndn.c:(.text+0x619): undefined reference to `roundeven'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndn_f32':
rndn.c:(.text+0x6cb): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndnh_f16':
rndn.c:(.text+0x7d6): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndn_f64':
rndn.c:(.text+0x940): undefined reference to `roundeven'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndnq_f32':
rndn.c:(.text+0x9db): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndnq_f16':
rndn.c:(.text+0xafc): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-native-c.p/rndn.c.o: in function `test_simde_vrndn_f16':
rndn.c:(.text+0xc36): undefined reference to `roundevenf'
collect2: error: ld returned 1 exit status
ninja: job failed: gcc  -o test/arm/neon/rndn-emul-c test/arm/neon/rndn-emul-c.p/rndn.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,--as-needed,-O1,--sort-common -Wl,-z,pack-relative-relocs -Os -fstack-clash-protection -Wformat -Werror=format-security -fno-plt -lm
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndnq_f64':
rndn.c:(.text+0x619): undefined reference to `roundeven'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndn_f32':
rndn.c:(.text+0x6cb): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndnh_f16':
rndn.c:(.text+0x7d6): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndn_f64':
rndn.c:(.text+0x940): undefined reference to `roundeven'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndnq_f32':
rndn.c:(.text+0x9db): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndnq_f16':
rndn.c:(.text+0xafc): undefined reference to `roundevenf'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test/arm/neon/rndn-emul-c.p/rndn.c.o: in function `test_simde_vrndn_f16':
rndn.c:(.text+0xc36): undefined reference to `roundevenf'
collect2: error: ld returned 1 exit status
ninja: subcommands failed
@mr-c
Copy link
Collaborator

mr-c commented Aug 12, 2024

Yes, this sounds correct. emscripten uses musl and ran into this as well:

((!defined(HEDLEY_EMSCRIPTEN_VERSION) || HEDLEY_EMSCRIPTEN_VERSION_CHECK(3, 1, 43)) && HEDLEY_HAS_BUILTIN(__builtin_roundeven)) || \

One could add a SIMDE_MUSL (or similar) to also skip the use of __builtin_roundeven for other musl users, unless there is a way for a header-only library to detect the use of musl at compile time

@mr-c
Copy link
Collaborator

mr-c commented Aug 12, 2024

ah, maybe there is a way to detect musl!

https://stackoverflow.com/a/78062291/1585509

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

No branches or pull requests

2 participants