[MacPorts] #71707: libtool (GNU) hardcodes CC and LD
MacPorts
noreply at macports.org
Wed Jan 1 15:01:12 UTC 2025
#71707: libtool (GNU) hardcodes CC and LD
--------------------------+---------------------
Reporter: barracuda156 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.10.5
Keywords: | Port: libtool
--------------------------+---------------------
How is this even supposed to work correctly? `/opt/local/bin/glibtool` is
a script, and it hardcodes a specific compiler, C standard and linker:
{{{
# ### BEGIN LIBTOOL CONFIG
# Which release of libtool.m4 was used?
macro_version=2.5.3
macro_revision=2.5.3
# Assembler program.
AS="as"
# DLL creation program.
DLLTOOL="false"
# Object dumper program.
OBJDUMP="false"
# Whether or not to build shared libraries.
build_libtool_libs=yes
# Whether or not to build static libraries.
build_old_libs=yes
# What type of objects to build.
pic_mode=default
# Whether or not to optimize for fast installation.
fast_install=needless
# Shared archive member basename,for filename based shared library
versioning on AIX.
shared_archive_member_spec=
# Shell to use when invoking shell scripts.
SHELL="/bin/sh"
# An echo program that protects backslashes.
ECHO="printf %s\\n"
# The PATH separator for the build system.
PATH_SEPARATOR=":"
# The host system.
host_alias=
host=powerpc-apple-darwin10.8.0
host_os=darwin10.8.0
# The build system.
build_alias=
build=powerpc-apple-darwin10.8.0
build_os=darwin10.8.0
# A sed program that does not truncate output.
SED="/usr/bin/sed"
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="$SED -e 1s/^X//"
# A grep program that handles long lines.
GREP="/usr/bin/grep"
# An ERE matcher.
EGREP="/usr/bin/grep -E"
# A literal string matcher.
FGREP="/usr/bin/grep -F"
# A BSD- or MS-compatible name lister.
NM="/usr/bin/nm -p"
# Whether we need soft or hard links.
LN_S="ln -s"
# GNU M4.
M4="/opt/local/bin/gm4"
# What is the maximum length of a command?
max_cmd_len=196608
# Object file suffix (normally "o").
objext=o
# Executable file suffix (normally "").
exeext=
# whether the shell understands "unset".
lt_unset=unset
# turn spaces into newlines.
SP2NL="tr \\040 \\012"
# turn newlines into spaces.
NL2SP="tr \\015\\012 \\040\\040"
# convert $build file names to $host format.
to_host_file_cmd=func_convert_file_noop
# convert $build files to toolchain format.
to_tool_file_cmd=func_convert_file_noop
# A file(cmd) program that detects file types.
FILECMD="file"
# Method to check whether dependent libraries are shared objects.
deplibs_check_method="pass_all"
# Command to use when deplibs_check_method = "file_magic".
file_magic_cmd="\$MAGIC_CMD"
# How to find potential files when deplibs_check_method = "file_magic".
file_magic_glob=""
# Find potential files using nocaseglob when deplibs_check_method =
"file_magic".
want_nocaseglob="no"
# Command to associate shared and link libraries.
sharedlib_from_linklib_cmd="printf %s\\n"
# The archiver.
AR="ar"
# Flags to create an archive (by configure).
lt_ar_flags=cr
# Flags to create an archive.
AR_FLAGS=${ARFLAGS-"$lt_ar_flags"}
# How to feed a file listing to the archiver.
archiver_list_spec=""
# A symbol stripping program.
STRIP="strip"
# Commands used to install an old-style archive.
RANLIB="ranlib"
old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
old_postuninstall_cmds=""
# Whether to use a lock for old archive extraction.
lock_old_archive_extraction=yes
# A C compiler.
LTCC="/usr/bin/gcc-4.2 -std=gnu99"
# LTCC compiler flags.
LTCFLAGS="-pipe -Os -arch ppc"
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe="/usr/bin/sed -n -e 's/^.*[
]\\([BCDEGRST][BCDEGRST]*\\)[ ][ ]*_\\([_A-Za-z][_A-
Za-z0-9]*\\)\$/\\1 _\\2 \\2/p' | /usr/bin/sed '/ __gnu_lto/d'"
# Transform the output of nm in a proper C declaration.
global_symbol_to_cdecl="/usr/bin/sed -n -e 's/^T .* \\(.*\\)\$/extern int
\\1();/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/extern char \\1;/p'"
# Transform the output of nm into a list of symbols to manually relocate.
global_symbol_to_import=""
# Transform the output of nm in a C name address pair.
global_symbol_to_c_name_address="/usr/bin/sed -n -e 's/^: \\(.*\\) .*\$/
{\"\\1\", (void *) 0},/p' -e 's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/
{\"\\1\", (void *) \\&\\1},/p'"
# Transform the output of nm in a C name address pair when lib prefix is
needed.
global_symbol_to_c_name_address_lib_prefix="/usr/bin/sed -n -e 's/^:
\\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[BCDEGRST][BCDEGRST]* .*
\\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e
's/^[BCDEGRST][BCDEGRST]* .* \\(.*\\)\$/ {\"lib\\1\", (void *)
\\&\\1},/p'"
# The name lister interface.
nm_interface="BSD nm"
# Specify filename containing input files for $NM.
nm_file_list_spec=""
# The root where to search for dependent libraries,and where our libraries
should be installed.
lt_sysroot=
# Command to truncate a binary pipe.
lt_truncate_bin="/bin/dd bs=4096 count=1"
# The name of the directory that contains temporary libtool files.
objdir=.libs
# Used to examine libraries when file_magic_cmd begins with "file".
MAGIC_CMD=file
# Must we lock files when doing compilation?
need_locks="no"
# Manifest tool.
MANIFEST_TOOL=":"
# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
DSYMUTIL="dsymutil"
# Tool to change global to local symbols on Mac OS X.
NMEDIT="nmedit"
# Tool to manipulate fat objects and archives on Mac OS X.
LIPO="lipo"
# ldd/readelf like tool for Mach-O binaries on Mac OS X.
OTOOL="otool"
# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
OTOOL64=":"
# Old archive suffix (normally "a").
libext=a
# Shared library suffix (normally ".so").
shrext_cmds="\`test .\$module = .yes && echo .so || echo .dylib\`"
# The commands to extract the exported symbol list from a shared archive.
extract_expsyms_cmds=""
# Variables whose values should be saved in libtool wrapper scripts and
# restored at link time.
variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX
COMPILER_PATH LIBRARY_PATH"
# Do we need the "lib" prefix for modules?
need_lib_prefix=no
# Do we need a version for libraries?
need_version=no
# Library versioning type.
version_type=darwin
# Shared library runtime path variable.
runpath_var=
# Shared library path variable.
shlibpath_var=DYLD_LIBRARY_PATH
# Is shlibpath searched before the hard-coded library search path?
shlibpath_overrides_runpath=yes
# Format of library name prefix.
libname_spec="lib\$name"
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME
library_names_spec="\$libname\$release\$major\$shared_ext
\$libname\$shared_ext"
# The coded name of the library, if different from the real name.
soname_spec="\$libname\$release\$major\$shared_ext"
# Permission mode override for installation of shared libraries.
install_override_mode=""
# Command to use after installation of a shared archive.
postinstall_cmds=""
# Command to use after uninstallation of a shared archive.
postuninstall_cmds=""
# Commands used to finish a libtool library installation in a directory.
finish_cmds=""
# As "finish_cmds", except a single script fragment to be evaled but
# not shown.
finish_eval=""
# Whether we should hardcode library paths into libraries.
hardcode_into_libs=no
# Compile-time system search path for libraries.
sys_lib_search_path_spec="/usr/lib/powerpc-apple-darwin10/4.2.1 /usr/lib
/opt/local/lib /usr/lib/gcc/powerpc-apple-darwin10/4.2.1 /usr/local/lib"
# Detected run-time system search path for libraries.
sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib"
# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
configure_time_lt_sys_library_path=""
# Whether dlopen is supported.
dlopen_support=yes
# Whether dlopen of programs is supported.
dlopen_self=yes
# Whether dlopen of statically linked programs is supported.
dlopen_self_static=yes
# Commands to strip libraries.
old_striplib="strip -S"
striplib="strip -x"
# The linker used to build libraries.
LD="/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/ld"
# How to create reloadable object files.
reload_flag=" -r"
reload_cmds="\$LTCC \$LTCFLAGS -nostdlib \$wl-r -o \$output\$reload_objs"
# Commands used to build an old-style archive.
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB
\$tool_oldlib"
# A language specific compiler.
CC="/usr/bin/gcc-4.2 -std=gnu99"
}}}
(Please ignore 10.6 here, this is not the point, since 10.5 also uses
gcc-4.2 by default.)
I spent a lot of time trying to fix `tilde` port which has a number of
dependencies, some of which require C++11, while others do not (therefore
different compilers are used). All of those use `libtool` port (i.e., GNU
`libtool`).
And look what the build does, after I patched out `--silent` flag:
{{{
---> Building libt3config
Executing: cd
"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libt3config/libt3config/work/libt3config-1.0.0"
&& /usr/bin/make -j6 -w all
make: Entering directory
`/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libt3config/libt3config/work/libt3config-1.0.0'
[CCLT] src/xdg.c
[CCLT] src/write.c
[CCLT] src/schema.c
[CCLT] src/parser.c
[CCLT] src/lex.c
[CCLT] src/pathsearch.c
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/write.c -fno-common -DPIC -o src/.libs/write.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/pathsearch.c -fno-common -DPIC -o src/.libs/pathsearch.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/schema.c -fno-common -DPIC -o src/.libs/schema.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/lex.c -fno-common -DPIC -o src/.libs/lex.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/xdg.c -fno-common -DPIC -o src/.libs/xdg.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/parser.c -fno-common -DPIC -o src/.libs/parser.o
[CCLT] src/config.c
[CCLT] src/util.c
[CCLT] src/expression.c
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/config.c -fno-common -DPIC -o src/.libs/config.o
[CCLT] src/config_shared.c
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/util.c -fno-common -DPIC -o src/.libs/util.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/expression.c -fno-common -DPIC -o src/.libs/expression.o
glibtool: compile: /opt/local/bin/gcc-mp-14 -pipe -Os -arch ppc
-DHAS_STRDUP -DHAS_USELOCALE -DUSE_XLOCALE_H -Isrc -DT3_CONFIG_BUILD_DSO
-c src/config_shared.c -fno-common -DPIC -o src/.libs/config_shared.o
[LDLT] src/libt3config.la
glibtool: link: /usr/bin/gcc-4.2 -std=gnu99 -dynamiclib -Wl,-undefined
-Wl,dynamic_lookup -o src/.libs/libt3config.0.dylib src/.libs/xdg.o
src/.libs/write.o src/.libs/pathsearch.o src/.libs/parser.o
src/.libs/lex.o src/.libs/schema.o src/.libs/config.o src/.libs/util.o
src/.libs/expression.o src/.libs/config_shared.o -L/opt/local/lib -Os
-arch ppc -Wl,-headerpad_max_install_names -arch ppc -install_name
/opt/local/lib/libt3config.0.dylib -compatibility_version 1
-current_version 1.1 -Wl,-single_module
glibtool: link: (cd "src/.libs" && rm -f "libt3config.dylib" && ln -s
"libt3config.0.dylib" "libt3config.dylib")
glibtool: link: ( cd "src/.libs" && rm -f "libt3config.la" && ln -s
"../libt3config.la" "libt3config.la" )
make: Leaving directory
`/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_libt3config/libt3config/work/libt3config-1.0.0'
}}}
Here I tried to blacklist `gcc-4.2` to get the port built with `gcc14`. It
does not work correctly, so no surprise everything is screwed in result:
linking is always done with the old Xcode gcc, regardless of the compiler
chosen by MacPorts.
I do not see anything in `libt3config` source to hardcode what is used for
linking. This probably comes from `libtool` itself.
--
Ticket URL: <https://trac.macports.org/ticket/71707>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list