Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Undefined references building riscv32-softmmu #35

Open
Git-Hub-2016 opened this issue Feb 7, 2021 · 0 comments
Open

Undefined references building riscv32-softmmu #35

Git-Hub-2016 opened this issue Feb 7, 2021 · 0 comments

Comments

@Git-Hub-2016
Copy link

I try to compile the following kernel on Ubuntu 20.04.1 LTS:

git clone https://github.com/qemu/qemu
git clone https://github.com/torvalds/linux
git clone https://git.busybox.net/busybox

git checkout v5.0.0
./configure --target-list=riscv32-softmmu
make -j $(nproc)
sudo make install

git checkout v5.4

make ARCH=riscv CROSS_COMPILE=riscv32-unknown-linux-gnu- defconfig
make ARCH=riscv CROSS_COMPILE=riscv32-unknown-linux-gnu- -j $(nproc)

CROSS_COMPILE=riscv32-unknown-linux-gnu- make defconfig
CROSS_COMPILE=riscv32-unknown-linux-gnu- make -j $(nproc)

... and end up with the following error message:

Trying libraries: crypt m rt
Failed: -Wl,--start-group -lcrypt -lm -lrt -Wl,--end-group
Output of:
riscv32-unknown-linux-gnu-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -finline-limit=0 -fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-builtin-printf -Os -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--gc-sections -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a klibc-utils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o klibc-utils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -lrt -Wl,--end-group

/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: coreutils/lib.a(mktemp.o): in function .L5': mktemp.c:(.text.mktemp_main+0x86): warning: the use of mktemp' is dangerous, better use mkstemp' or mkdtemp'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function add_query': nslookup.c:(.text.add_query+0xb8): undefined reference to __res_mkquery'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L59': nslookup.c:(.text.send_queries+0x40e): undefined reference to ns_initparse'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L63': nslookup.c:(.text.send_queries+0x476): undefined reference to ns_parserr'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L130': nslookup.c:(.text.send_queries+0x59a): undefined reference to ns_name_uncompress'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L81': nslookup.c:(.text.send_queries+0x606): undefined reference to ns_get16'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x62e): undefined reference to ns_name_uncompress' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L70':
nslookup.c:(.text.send_queries+0x6f2): undefined reference to ns_name_uncompress' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x714): undefined reference to ns_get16'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x722): undefined reference to ns_get16' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x730): undefined reference to ns_get16'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L86': nslookup.c:(.text.send_queries+0x7a2): undefined reference to ns_name_uncompress'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x7d0): undefined reference to ns_name_uncompress' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L74':
nslookup.c:(.text.send_queries+0x7f6): undefined reference to ns_get32' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: networking/lib.a(nslookup.o): in function .L87':
nslookup.c:(.text.send_queries+0x810): undefined reference to ns_get32' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x82a): undefined reference to ns_get32'
/opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x844): undefined reference to ns_get32' /opt/riscv/lib/gcc/riscv32-unknown-linux-gnu/10.2.0/../../../../riscv32-unknown-linux-gnu/bin/ld: nslookup.c:(.text.send_queries+0x85e): undefined reference to ns_get32'
collect2: error: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
make: *** [Makefile:718: busybox_unstripped] Error 1

The RISCV toolchain is installed as such:

https://github.com/riscv/riscv-gnu-toolchain
./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant