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

zig cc unable to build hello-world for target s390x-linux-gnu #21076

Closed
bjia56 opened this issue Aug 14, 2024 · 2 comments · Fixed by #21195
Closed

zig cc unable to build hello-world for target s390x-linux-gnu #21076

bjia56 opened this issue Aug 14, 2024 · 2 comments · Fixed by #21195
Labels
arch-s390x 64-bit IBM z/Architecture bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@bjia56
Copy link

bjia56 commented Aug 14, 2024

Zig Version

0.14.0-dev.1052+d6f997259

Steps to Reproduce and Observed Behavior

$ cat test.c
#include <stdio.h>

int main() {
    printf("Hello world!");
}
$ ./zig-linux-x86_64-0.14.0-dev.1052+d6f997259/zig cc -target s390x-linux-gnu.2.19 test.c -o test
error: sub-compilation of glibc crti.o failed
    note: unable to check cache: stat file 'zig-linux-x86_64-0.14.0-dev.1052+d6f997259/lib/libc/glibc/sysdeps/crti.S' failed: FileNotFound
error: unable to build glibc CRT file: SubCompilationFailed
error: sub-compilation of glibc crtn.o failed
    note: unable to check cache: stat file 'zig-linux-x86_64-0.14.0-dev.1052+d6f997259/lib/libc/glibc/sysdeps/crtn.S' failed: FileNotFound
error: sub-compilation of glibc Scrt1.o failed
    note: unable to check cache: stat file 'zig-linux-x86_64-0.14.0-dev.1052+d6f997259/lib/libc/glibc/sysdeps/start-2.33.S' failed: FileNotFound
$ ./zig-linux-x86_64-0.14.0-dev.1052+d6f997259/zig cc -target s390x-linux-gnu test.c -o test
/home/brettjia/.cache/zig/o/b6158625386ad44943fac58bc9e70c2f/m.s:4025:1: error: symbol 'lgammal' is already defined
lgammal:
^

Expected Behavior

Compilation succeeds.

@bjia56 bjia56 added the bug Observed behavior contradicts documented or intended behavior label Aug 14, 2024
@rootbeer
Copy link
Contributor

rootbeer commented Aug 14, 2024

Reproduced.

Changing the target glibc version changes the error a bit. A more recent glibc just has the lgammal error:

$ zig cc -target s390x-linux-gnu.2.29 hello.c -o hello
/home/pat/projects/ziglang/zig-global-cache/o/562e59d6889be0dcc813888297ac739a/m.s:4041:1: error: symbol 'lgammal' is already defined
lgammal:
^
$

Depending on your goals, as a work-around the Musl targets seem to work fine:

$ zig  cc -target s390x-linux-musl hello.c -o hello
$

@alexrp
Copy link
Member

alexrp commented Aug 14, 2024

See also #20376.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-s390x 64-bit IBM z/Architecture bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants