Question

Error

I'm receiving the following error when I try execute make for a autotools based project on OS X:

libtool: link: unsupported hardcode properties
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.

make calls libtool as follows:

/bin/sh ./libtool  --tag=CXX   --mode=link clang++  -g <blah blah blah>

Investigation

I've narrowed the problem down specifically to the use of the CXX tag. For some reason the libtool script (generated by running ./configure and hence libtoolize etc.) spits out a CXX configuration as follows:

# ### BEGIN LIBTOOL TAG CONFIG: CXX

# The linker used to build libraries.
LD=""

# How to create reloadable object files.
reload_flag=""
reload_cmds=""

# Commands used to build an old-style archive.
old_archive_cmds=""

# A language specific compiler.
CC=""

# Is the compiler the GNU compiler?
with_gcc=

# Compiler flag to turn off builtin functions.
no_builtin_flag=""

# Additional compiler flags for building library objects.
pic_flag=""

# How to pass a linker flag through the compiler.
wl=""

# Compiler flag to prevent dynamic linking.
link_static_flag=""

# Does compiler simultaneously support -c and -o options?
compiler_c_o=""

# Whether or not to add -lc for building shared libraries.
build_libtool_need_lc=

# Whether or not to disallow shared libs when runtime libs are static.
allow_libtool_libs_with_static_runtimes=

# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec=""

# Compiler flag to generate shared objects directly from archives.
whole_archive_flag_spec=""

# Whether the compiler copes with passing no objects directly.
compiler_needs_object=""

# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=""

# Create a temporary old-style archive to link instead of a shared archive.
old_archive_from_expsyms_cmds=""

# Commands used to build a shared archive.
archive_cmds=""
archive_expsym_cmds=""

# Commands used to build a loadable module if different from building
# a shared archive.
module_cmds=""
module_expsym_cmds=""

# Whether we are building with GNU ld or not.
with_gnu_ld=""

# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=""

# Flag that enforces no undefined symbols.
no_undefined_flag=""

# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist
hardcode_libdir_flag_spec=""

# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=""

# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
# DIR into the resulting binary.
hardcode_direct=

# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
# DIR into the resulting binary and the resulting library dependency is
# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
# library is relocated.
hardcode_direct_absolute=

# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
# into the resulting binary.
hardcode_minus_L=

# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
# into the resulting binary.
hardcode_shlibpath_var=

# Set to "yes" if building a shared library automatically hardcodes DIR
# into the library and all subsequent libraries and executables linked
# against it.
hardcode_automatic=

# Set to yes if linker adds runtime paths of dependent libraries
# to runtime path list.
inherit_rpath=

# Whether libtool must link a program against all its dependency libraries.
link_all_deplibs=

# Set to "yes" if exported symbols are required.
always_export_symbols=

# The commands to list exported symbols.
export_symbols_cmds=""

# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms=""

# Symbols that must always be exported.
include_expsyms=""

# Commands necessary for linking programs (against libraries) with templates.
prelink_cmds=""

# Commands necessary for finishing linking programs.
postlink_cmds=""

# Specify filename containing input files.
file_list_spec=""

# How to hardcode a shared library path into an executable.
hardcode_action=

# The directories searched by this compiler when creating a shared library.
compiler_lib_search_dirs=""

# Dependencies to place before and after the objects being linked to
# create a shared library.
predep_objects=""
postdep_objects=""
predeps=""
postdeps=""

# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path=""

# ### END LIBTOOL TAG CONFIG: CXX

As you can see, everything is blank. So the libtool script freaks out, and rightly so. So my confusion lies in how the libtool script ended up including this bogus CXX configuration.

The CC configuration is fine. Simply calling the libtool script with --tag=CC is actually enough to get my project linking just fine. However, that's obviously not correct; you should simply be able to execute:

./configure
make

./configure output

checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for DEPS... yes
checking for udevadm... no
checking build system type... x86_64-apple-darwin12.3.0
checking host system type... x86_64-apple-darwin12.3.0
checking target system type... x86_64-apple-darwin12.3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin12.3.0 file names to x86_64-apple-darwin12.3.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin12.3.0 file names to toolchain format... func_convert_file_noop
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking operating system... Darwin/MacOS X
checking for clang++... clang++
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ accepts -g... yes
checking dependency style of clang++... gcc3
checking whether byte ordering is bigendian... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

Setup details

libtool version: 2.4.2

libtool revision: 1.3337

autoconf version: GNU Autoconf 2.69

clang++ version: Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)

Was it helpful?

Solution

This was caused by AC_PROG_LIBTOOL (since deprecated in favour of LT_INIT) appearing before AC_PROG_CXX([clang++]) in configure.ac.

Strangely enough the LT_INIT/LT_LANG documentation actually shows LT_INIT appearing before AC_PROG_CXX, so I'm not entirely sure why this turned out to be a problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top