buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [Bug 15401] New: host-rust-1.67.0 does not compile due to missing mallinfo2 and arc4random
@ 2023-03-17  9:52 bugzilla
  2023-03-17  9:55 ` [Buildroot] [Bug 15401] " bugzilla
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bugzilla @ 2023-03-17  9:52 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=15401

            Bug ID: 15401
              Host: x86_64
             Build: x86_64 (Debian 11)
           Summary: host-rust-1.67.0 does not compile due to missing
                    mallinfo2 and arc4random
           Product: buildroot
           Version: 2023.02
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned@buildroot.uclibc.org
          Reporter: alban.at.ifd@gmail.com
                CC: buildroot@uclibc.org
  Target Milestone: ---

Created attachment 9531
  --> https://bugs.busybox.net/attachment.cgi?id=9531&action=edit
defconfig

I only want to build a toolchain with a rust compiler so I have the following
defconfig:

BR2_x86_64=y
BR2_KERNEL_HEADERS_5_4=y
BR2_GCC_VERSION_12_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PRIMARY_SITE="<internal mirror populated with "make sources">"
BR2_INIT_NONE=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_LIBBSD=y
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_RUSTC=y
BR2_PACKAGE_HOST_RUST=y

The compilation of rust (host-rust-1.67.0) is not working. It fails with the
following message when I call the "make" command:

[  7%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/RWMutex.cpp.o
In file included from
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Process.cpp:107:
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Unix/Process.inc: In
static member function ‘static size_t llvm::sys::Process::GetMallocUsage()’:
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Unix/Process.inc:92:20:
error: aggregate ‘llvm::sys::Process::GetMallocUsage()::mallinfo2 mi’ has
incomplete type and cannot be defined
   92 |   struct mallinfo2 mi;
      |                    ^~
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Unix/Process.inc:93:10:
error: ‘::mallinfo2’ has not been declared
   93 |   mi = ::mallinfo2();
      |          ^~~~~~~~~
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Unix/Process.inc: In
static member function ‘static unsigned int
llvm::sys::Process::GetRandomNumber()’:
build/host-rust-1.67.0/src/llvm-project/llvm/lib/Support/Unix/Process.inc:455:10:
error: ‘arc4random’ was not declared in this scope; did you mean ‘srandom’?
  455 |   return arc4random();
      |          ^~~~~~~~~~
      |          srandom
[  7%] Building CXX object
lib/Support/CMakeFiles/LLVMSupport.dir/ThreadLocal.cpp.o
[  7%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o
gmake[4]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/build.make:1902:
lib/Support/CMakeFiles/LLVMSupport.dir/Process.cpp.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[4]: Leaving directory
'build/host-rust-1.67.0/build/x86_64-unknown-linux-gnu/llvm/build'
gmake[3]: *** [CMakeFiles/Makefile2:7354:
lib/Support/CMakeFiles/LLVMSupport.dir/all] Error 2
gmake[3]: Leaving directory
'build/host-rust-1.67.0/build/x86_64-unknown-linux-gnu/llvm/build'
gmake[2]: *** [Makefile:171: all] Error 2
gmake[2]: Leaving directory
'build/host-rust-1.67.0/build/x86_64-unknown-linux-gnu/llvm/build'
thread 'main' panicked at '
command did not execute successfully, got: exit status: 2

I confirm that the CMake of LLVM detects both arc4random and mallinfo2
features, inside
build/host-rust-1.67.0/build/x86_64-unknown-linux-gnu/llvm/build/CMakeCache.txt,
I have the following:

//Have symbol arc4random
HAVE_DECL_ARC4RANDOM:INTERNAL=1

and

//Have symbol mallinfo2
HAVE_MALLINFO2:INTERNAL=1

For information, when I try to build the vanilla rustc 1.67.0 (from github)
directly with the toolchain of my system (gcc 10.2.1, Debian 11), the two
"features" are not detected by CMake and the compilation works. But when I copy
the config.toml generated by rust.mk into the vanilla rust sources, the
compilation is failling with the same error: I am able to reproduce the problem
with the vanilla sources.

I managed to implement a workaround with the following patch applied on
buildroot's sources:

diff --git a/package/rust/rust.mk b/package/rust/rust.mk
index d14ad3a3e7..d11a39e4a5 100644
--- a/package/rust/rust.mk
+++ b/package/rust/rust.mk
@@ -60,8 +60,6 @@ define HOST_RUST_CONFIGURE_CMDS
                echo '[rust]'; \
                echo 'channel = "stable"'; \
                echo 'musl-root = "$(STAGING_DIR)"' ; \
-               echo '[target.$(RUSTC_TARGET_NAME)]'; \
-               echo 'cc = "$(TARGET_CROSS)gcc"'; \
                echo '[llvm]'; \
                echo 'ninja = false'; \
        ) > $(@D)/config.toml

I am suprised to see here that the cross-compiler was defined as cc in the
generated config.toml, as we want to build a rust compiler which can be
executed on the host system, not on the target system.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-03 12:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  9:52 [Buildroot] [Bug 15401] New: host-rust-1.67.0 does not compile due to missing mallinfo2 and arc4random bugzilla
2023-03-17  9:55 ` [Buildroot] [Bug 15401] " bugzilla
2023-03-17  9:55 ` bugzilla
2023-03-21 12:08 ` bugzilla
2023-03-21 12:11 ` bugzilla
2023-03-21 12:12 ` bugzilla
2023-03-21 14:47 ` bugzilla
2023-04-03 12:20 ` bugzilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).