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

[Runner] Work around wrong path of compiler libraries for riscv64. Again #407

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,13 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
# the wrappers before any additional arguments because we want this path to have
# precedence over anything else. In this way for example we avoid libraries
# from `CompilerSupportLibraries_jll` in `${libdir}` are picked up by mistake.
dir = "/opt/$(aatriplet(p))/$(aatriplet(p))/lib" * (nbits(p) == 32 ? "" : "64")
# Note 2: Compiler libraries for riscv64 ended up in `lib/` for some reason, and
# are always in `lib/` for FreeBSD.
# Note 3: while these are technically link-only flags, link-only flags are
# written out in our wrappers as "post flags" after those passed on the command
# line, but we really need to have these flags before those to solve
# <https://github.com/JuliaPackaging/BinaryBuilderBase.jl/issues/163>.
dir = "/opt/$(aatriplet(p))/$(aatriplet(p))/lib" * (nbits(p) == 32 || arch(p) == "riscv64" || Sys.isfreebsd(p) ? "" : "64")
append!(flags, ("-L$(dir)", "-Wl,-rpath-link,$(dir)"))
end
if lock_microarchitecture
Expand Down
12 changes: 11 additions & 1 deletion test/runners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,17 @@ end
std::complex<double> z3 = add(std::complex<double>(1.,2.),std::complex<double>(4.,2.));
return 0;
}
"""
"""
main_c = """
int main(void) {
return 0;
}
"""
test_script = """
set -e
echo '$(test_cpp)' > test.cpp
echo '$(main_cpp)' > main.cpp
echo '$(main_c)' > main.c
# Make sure setting `CCACHE` doesn't affect the compiler wrappers.
export CCACHE=pwned
export USE_CCACHE=true
Expand All @@ -238,6 +244,10 @@ end
$(linker) -o main main.o test.o
# Link main program with shared library
$(linker) -o main main.o -L. -ltest

# Also make sure we can link to libtest (which may link to
# libstdc++) with gcc (as in the C compiler).
gcc -o main_c main.c -ltest -L.
"""
cmd = `/bin/bash -c "$(test_script)"`
@test run(ur, cmd, iobuff; tee_stream=devnull)
Expand Down
Loading