2023-02-23

Slitaz64 - compiling and linking - toolchain

 

compiling and linking - toolchain

make clear, we are talking about the toolchain.

1.

/usr/lib/gcc/x86_64-slitaz-linux-gnu/12.2.0/crtend.o crtn.o
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status

# tazpkg -sp crt1.o
Search result for package "crt1.o"
glibc-dev

# tazpkg -lf glibc-dev | grep crt[1in].o
/usr/lib64/Mcrt1.o
/usr/lib64/Scrt1.o
/usr/lib64/crt1.o
/usr/lib64/crti.o
/usr/lib64/crtn.o
/usr/lib64/gcrt1.o
/usr/lib64/grcrt1.o
/usr/lib64/rcrt1.o

2.

echo 'int main(){}' | gcc -xc -

> # echo 'int main() { return 0; }' > test.c
> # gcc -v -o test.o test.c

ensure that the basic functions (compiling and linking) of the toolchain are working as expected.
If everything is working correctly, there should be no errors,

3.

8.5.1. Installation of Glibc

Prepare Glibc for compilation:
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=3.2 \
--enable-stack-protector=strong \
--with-headers=/usr/include \
libc_cv_slibdir=/usr/lib

The meaning of the configure options:
[..]
libc_cv_slibdir=/usr/lib
This variable sets the correct library for all systems. We do not want lib64 to be used.

8.5.2.3. Configuring the Dynamic Loader
By default, the dynamic loader (/lib/ld-linux.so.2) searches through /usr/lib for dynamic libraries that are needed by programs as they are run. However, if there are libraries in directories other than /usr/lib, these need to be added to the /etc/ld.so.conf file in order for the dynamic loader to find them. 
Two directories that are commonly known to contain additional libraries are /usr/local/lib and /opt/lib, so add those directories to the dynamic loader's search path.

more details..
https://www.linuxfromscratch.org/lfs/view/11.2/chapter08/glibc.html#contents-glibc

https://www.linuxfromscratch.org/lfs/view/11.2/chapter05/glibc.html


https://forum.slitaz.org/topic/slitaz-future/page/18#post-51394