This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Issue with Linker can't find lib's.
- From: Ghalib Khan <ghalib dot khan at exaleapsemi dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 25 Jun 2019 09:42:32 +0000
- Subject: Issue with Linker can't find lib's.
Hi
I tried to a Build Riscv cross Toolchain with upstream sources.
step1: clone sources from http://mirrors.kernel.org/gnu/ binutils_version=2.32 gcc_version=9.1.0 glibc_version=2.29
-----------
& http://ftp.ntu.edu.tw/linux/kernel/v5.x/linux_version.5.1.9
step2: Build with a configuration as below,
--------------
build-binutils-linux
$ ./configure \
--target=riscv64-unknown-linux-gnu \
\
--prefix=$(INSTALL_DIR) \
--with-sysroot=$(INSTALL_DIR)/sysroot \
--disable-multilib \
\
--disable-werror \
--disable-nls \
--with-expat=yes \
--disable-gdb \
--disable-sim \
--disable-libdecnumber \
--disable-readline
make all
make install
build-gcc-linux
$ ./configure \
--target=riscv64-unknown-linux-gnu \
\
--prefix=$(INSTALL_DIR) \
--with-sysroot=$(INSTALL_DIR)/sysroot \
--with-newlib \
--without-headers \
--disable-shared \
--disable-threads \
--with-system-zlib \
--enable-tls \
--enable-languages=c \
--disable-libatomic \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-libgomp \
--disable-nls \
--disable-bootstrap \
--src=$(PWD)/gcc-$(gcc_version) \
--enable-checking=yes \
--disable-multilib \
--with-abi=lp64d \
--with-arch=rv64imafdc \
CFLAGS_FOR_TARGET="-O2 -mcmodel=medlow" \
CXXFLAGS_FOR_TARGET="-O2 -mcmodel=medlow"
make all-gcc
make install-gcc
make all-target-libgcc
make install-target-libgcc
build-glibc-linux
$ ./configure \
CC="riscv64-unknown-linux-gnu-gcc " \
CXX="riscv64-unknown-linux-gnu-g++ " \
CFLAGS=" -mcmodel=medlow -g -O2 " \
CXXFLAGS=" -mcmodel=medlow -g -O2 " \
ASFLAGS=" -mcmodel=medlow " \
--host=riscv64-unknown-linux-gnu \
--prefix=$(INSTALL_DIR) \
--with-sysroot=$(INSTALL_DIR)/sysroot \
--disable-werror \
--enable-shared \
--enable-obsolete-rpc \
--with-headers=$(INSTALL_DIR)/include \
--disable-multilib \
--enable-add-ons \
--enable-kernel=$(linux_version) \
\
--libdir=$(INSTALL_DIR)/sysroot/usr/lib libc_cv_slibdir=$(INSTALL_DIR)/sysroot/lib libc_cv_rtlddir=$(INSTALL_DIR)/sysroot/lib
build-glibc-linux-headers
./configure \
CC="riscv64-unknown-linux-gnu-gcc " \
--host=riscv64-unknown-linux-gnu \
--prefix=$(INSTALL_DIR)/sysroot/usr \
--with-sysroot=$(INSTALL_DIR)/sysroot \
--enable-shared \
--with-headers=$(INSTALL_DIR)/include \
--disable-multilib \
--enable-add-ons \
--enable-kernel=$(linux_version)
make -C Build/build-glibc-linux-headers install-bootstrap-headers=yes install-headers
make -C Build/build-glibc-linux-headers csu/subdir_lib
make -C Build/build-gcc-linux all-target-libgcc
make -C Build/build-gcc-linux install-target-libgcc
make -C Build/build-glibc-linux all
make -C Build/build-glibc-linux install_root=$(INSTALL_DIR)/sysroot install
make -C Build/build-gcc-linux all
make -C Build/build-gcc-linux install
cp -a $(INSTALL_DIR)/include $(INSTALL_DIR)/sysroot/usr/
step3: Got the Executables, It has all the libraries in the same location but it is unable to find them i don't know why. getting an Error as shown
----------
below,
<home/riscv/install>/bin/../lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find <home/riscv/install>/sysroot/lib/libc.so.6 inside <home/riscv/install>/bin/../sysroot
<home/riscv/install>/bin/../lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find <home/riscv/install>/sysroot/usr/lib/libc_nonshared.a inside <home/riscv/install>/bin/../sysroot
<home/riscv/install>/bin/../lib/gcc/riscv64-unknown-linux-gnu/9.1.0/../../../../riscv64-unknown-linux-gnu/bin/ld: cannot find <home/riscv/install>/sysroot/lib/ld-linux-riscv64-lp64d.so.1 inside <home/riscv/install>/bin/../sysroot
collect2: error: ld returned 1 exit status
--> Here
can you Help me to Build upstream sources Riscv-gnu-Toolchain.
Regards,
khan.