buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
From: bugzilla@busybox.net
To: buildroot@uclibc.org
Subject: [Buildroot] [Bug 15401] New: host-rust-1.67.0 does not compile due to missing mallinfo2 and arc4random
Date: Fri, 17 Mar 2023 09:52:24 +0000	[thread overview]
Message-ID: <bug-15401-163@https.bugs.busybox.net/> (raw)

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

             reply	other threads:[~2023-03-17  9:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  9:52 bugzilla [this message]
2023-03-17  9:55 ` [Buildroot] [Bug 15401] host-rust-1.67.0 does not compile due to missing mallinfo2 and arc4random 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15401-163@https.bugs.busybox.net/ \
    --to=bugzilla@busybox.net \
    --cc=buildroot@uclibc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).