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: unsupported linker arg: -rpath-link #18713

Open
bjia56 opened this issue Jan 28, 2024 · 2 comments
Open

zig cc: unsupported linker arg: -rpath-link #18713

bjia56 opened this issue Jan 28, 2024 · 2 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Milestone

Comments

@bjia56
Copy link

bjia56 commented Jan 28, 2024

Zig Version

0.12.0-dev.2341+92211135f

Steps to Reproduce and Observed Behavior

Compile X11 from source, e.g. the following Dockerfile on x86_64:

FROM ubuntu:22.04

RUN apt update && \
    apt -y install wget build-essential git autoconf pkg-config python3 python3-pip
RUN wget https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.2341+92211135f.tar.xz && \
    tar -xf zig*.tar.xz && \
    rm zig*.tar.xz
ENV PATH ${PATH}:/zig-linux-x86_64-0.12.0-dev.2341+92211135f
RUN pip install https://github.com/mesonbuild/meson/archive/2baae24.zip ninja
RUN mkdir /build && mkdir /deps
WORKDIR /build

ARG TARGET=x86_64-linux-gnu.2.17
ENV AR="zig ar"
ENV CC="zig cc -target ${TARGET}"
ENV CXX="zig c++ -target ${TARGET}"

RUN zig version

RUN git clone git://anongit.freedesktop.org/git/xorg/util/modular util/modular && \
    ./util/modular/build.sh --clone /deps

Gives the following error:

37.10 [5/5] Linking target cvt/cvt
37.10 FAILED: cvt/cvt
37.10 zig cc -target x86_64-linux-gnu.2.17  -o cvt/cvt cvt/cvt.p/cvt.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../lib' -Wl,-rpath-link,/build/lib/libxcvt/builddir/lib -Wl,--start-group lib/libxcvt.so.0.1.2 -lm -Wl,--end-group
37.10 error: unsupported linker arg: -rpath-link

Expected Behavior

X11 can be compiled from source when using zig cc

@bjia56 bjia56 added the bug Observed behavior contradicts documented or intended behavior label Jan 28, 2024
@louie-github
Copy link

I'm also encountering the same issue compiling libjxl:

[278/381] Linking CXX executable decode_oneshot
FAILED: decode_oneshot
: && /usr/sbin/zig  c++ -march=native -mtune=native -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto=thin  -Wp,-D_GLIBCXX_ASSERTIONS -fno-rtti -O3 -DNDEBUG -fPIE -pie CMakeFiles/decode_oneshot.dir/examples/decode_oneshot.cc.o -o decode_oneshot  -Wl,-rpath,/home/louie/dev/libjxl/build-zig/lib:/home/louie/dev/libjxl/build-zig/third_party/brotli  lib/libjxl_dec.so.0.10.1  lib/libjxl_threads.so.0.10.1  -Wl,-rpath-link,/home/louie/dev/libjxl/build-zig/third_party/brotli && :
error: unsupported linker arg: -rpath-link

@andy5995
Copy link

andy5995 commented Mar 10, 2024

Related discussion on this meson PR

I've opened a separate PR to add zig to their ubuntu-rolling docker image.

RossComputerGuy added a commit to RossComputerGuy/meson that referenced this issue Jul 31, 2024
RossComputerGuy added a commit to RossComputerGuy/meson that referenced this issue Aug 6, 2024
dcbaker pushed a commit to mesonbuild/meson that referenced this issue Sep 24, 2024
@alexrp alexrp added the linking label Dec 8, 2024
@alexrp alexrp added this to the 0.15.0 milestone Dec 8, 2024
@alexrp alexrp added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. and removed bug Observed behavior contradicts documented or intended behavior labels Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. linking
Projects
None yet
Development

No branches or pull requests

4 participants