pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

buildlink3 vs. rust on powerpc?



Hi,

the patch which previously disabled the check for 8-byte atomics
in llvm has been removed, and instead we're now relying on
devel/libatomic for supplying the required functionality on the
NetBSD/powerpc ports.

Rust 1.47.0 brings us llvm 11 internally.  I have provisionally
added this snippet to the rust Makefile:

.if (${MACHINE_ARCH} == "powerpc")
# LLVM needs libatomic for 64-bit atomics on powerpc
.include "../../devel/libatomic/buildlink3.mk"
.endif

That gets me further than before -- the internal LLVM now builds,
but the build now bombs because rust can't find where -latomic is
when it tries to link librustc_driver-49ee60c26d716438.so.

In rust/work/.work.log I find:

<.> /usr/pkgsrc/lang/rust/work/.gcc/bin/gcc -fcommon
-Wl,--as-needed -m32 -Wl,--eh-frame-hdr
-L/usr/pkgsrc/lang/rust/work/rustc-1.47.0-src/build/powerpc-unknown-netbsd/stage0-sysroot/lib/rustlib/powerpc-unknown-netbsd/lib
<lots of *.o files>
shared -Wl,-zrelro -Wl,-znow -Wl,-O1
<lots of -L options pointing into the build tree>
-Wl,-Bstatic -Wl,--whole-archive
/tmp/rustcG5LK9X/libtracing_subscriber-5e20e687bf429d56.rlib
-Wl,--no-whole-archive
(repeats lots of times with similar *.rlib files)
-Wl,--no-whole-archive -Wl,--start-group -Wl,-Bdynamic
-lstd-9d223a9ee43e47a1 -Wl,--end-group -Wl,-Bstatic
/tmp/rustcG5LK9X/libcompiler_builtins-86b33008babe22bf.rlib
-Wl,-Bdynamic -lrt -lexecinfo -latomic -lpthread -lm -lstdc++
-lutil -lrt -lutil -lexecinfo -lpthread -lrt -lgcc_s -lc -lm -lrt
-lpthread -lutil -lrt -lutil -Wl,-rpath,/usr/pkg/lib
-D_FORTIFY_SOURCE=2 -fstack-protector
-I/usr/pkgsrc/lang/rust/work/.buildlink/include

Now, you will know that -latomic can be found either in
work/.buildlink/lib/ (symlink put there by buildlink) or in
/usr/pkg/lib.  However, the gcc invocation mentiones none of
those direcotories, and of course the build aborts with

  = note: ld: cannot find -latomic

error: aborting due to previous error

Now...  The first question I have is why would not the cwrapper
layer have included the .buildlink/lib directory in the library
search path?  The second is whether anyone has any other hints
about how I should go about fixing this?  How could I convince
rustc to include e.g. -L/usr/pkg/lib in the command line before
-latomic is referenced?

Any hints welcome.

Regards,

- Håvard


Home | Main Index | Thread Index | Old Index