richfelker / musl-cross-make

Simple makefile-based build for musl cross compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken Libtool library files

Ypnose opened this issue · comments

Hello,
First of all, thanks for this tool, I use it extensively for my projects, well done !
After the cross compiler is built and installed inside the OUTPUT directory, I noticed Libtool *.la* files are broken. The path written in libdir= is wrong.

This is my config.mak :

TARGET = x86_64-linux-musl
OUTPUT = /tmp/cross-x86_64

DL_CMD = curl -C - -L -o

MUSL_CONFIG += --disable-shared

COMMON_CONFIG += --disable-nls --disable-shared --enable-languages=c
COMMON_CONFIG += CC="gcc -static --static" CXX="g++ -static --static"

GCC_CONFIG += --enable-languages=c
GCC_CONFIG += --disable-libquadmath --disable-decimal-float
GCC_CONFIG += --disable-multilib
GCC_CONFIG += --with-arch=x86-64

After, I launched make install :

$ ls -l /tmp/cross-x86_64/x86_64-linux-musl/lib/
total 5.2M
-rw-r--r-- 1 yp yp 1.6K Dec 29 12:26 crt1.o
-rw-r--r-- 1 yp yp 1016 Dec 29 12:26 crti.o
-rw-r--r-- 1 yp yp  960 Dec 29 12:26 crtn.o
drwxr-xr-x 2 yp yp 2.7K Dec 29 12:26 ldscripts/
-rw-r--r-- 1 yp yp 291K Dec 29 12:26 libatomic.a
-rwxr-xr-x 1 yp yp  907 Dec 29 12:26 libatomic.la*
-rw-r--r-- 1 yp yp 2.6M Dec 29 12:26 libc.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libcrypt.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libdl.a
-rw-r--r-- 1 yp yp 2.2M Dec 29 12:26 libgomp.a
-rwxr-xr-x 1 yp yp  897 Dec 29 12:26 libgomp.la*
-rw-r--r-- 1 yp yp  158 Dec 29 12:26 libgomp.spec
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libm.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libpthread.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libresolv.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 librt.a
-rw-r--r-- 1 yp yp  64K Dec 29 12:26 libssp.a
-rwxr-xr-x 1 yp yp  889 Dec 29 12:26 libssp.la*
-rw-r--r-- 1 yp yp 3.1K Dec 29 12:26 libssp_nonshared.a
-rwxr-xr-x 1 yp yp  919 Dec 29 12:26 libssp_nonshared.la*
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libutil.a
-rw-r--r-- 1 yp yp    8 Dec 29 12:26 libxnet.a
-rw-r--r-- 1 yp yp 2.2K Dec 29 12:26 rcrt1.o
-rw-r--r-- 1 yp yp 1.6K Dec 29 12:26 Scrt1.o

Let's open libatomic.la file :

# libatomic.la - a libtool library file
# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname=''

# Names of this library.
library_names=''

# The name of the static archive.
old_library='libatomic.a'

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=' -pthread'

# Libraries that this one depends upon.
dependency_libs=''

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for libatomic.
current=3
age=2
revision=0

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/x86_64-linux-musl/lib'

libdir line does not include /tmp/cross-x86_64 path. It is the same with other *.la files.

commented

.la files are generally not needed on modern Linux systems, and in some cases can cause linking issues. See:

For musl and other sufficiently low-level libraries, it should be safe to remove them; if the system can't find ld.so and/or libc.so you have bigger problems to sort out. If you're not comfortable removing the .la files, it's probably best to fix them with sed.

Thanks for your message, I'll keep that in mind.