macos - libtool:链接:不支持的硬编码属性 - 空白 CXX 配置

标签 macos configure autotools libtool clang++

错误

当我尝试在 OS X 上为基于自动工具的项目执行 make 时,收到以下错误:

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

调用 libtool 如下:

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

调查

我已将问题范围缩小到 CXX 标记的使用。由于某种原因,libtool 脚本(通过运行 ./configure 生成,因此运行 libtoolize 等)会输出 CXX 配置,如下所示:

# ### 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

如您所见,一切都是空白。所以 libtool 脚本会崩溃,这是理所当然的。所以我的困惑在于 libtool 脚本最终如何包含这个伪造的 CXX 配置。

CC配置没问题。只需使用 --tag=CC 调用 libtool 脚本实际上就足以让我的项目链接得很好。然而,这显然是不正确的;你应该能够简单地执行:

./configure
make

./配置输出

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

设置详细信息

libtool版本:2.4.2

libtool 修订版: 1.3337

autoconf 版本: GNU Autoconf 2.69

clang++ 版本: Apple LLVM 版本 4.2 (clang-425.0.24)(基于 LLVM 3.2svn)

最佳答案

这是由 AC_PROG_LIBTOOL(现已弃用,取而代之的是 LT_INIT)引起的,AC_PROG_CXX([clang++]) 出现在configure.ac 中的 AC_PROG_CXX([clang++]) 之前。

奇怪的是LT_INIT/LT_LANG文档实际上显示 LT_INIT 出现在 AC_PROG_CXX 之前,所以我不完全确定为什么这会成为一个问题。

关于macos - libtool:链接:不支持的硬编码属性 - 空白 CXX 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16942530/

相关文章:

objective-c - 使用 NSFileWrapper 时,有没有办法通过多次写入 NSData 对象 block 来处理巨大的输出文件?

linux - 错误编译 freetype make : Nothing to be done for 'unix'

r - 如何使用autoconf重新生成配置文件?

c - 我怎样才能改变这些变量?

linux - 尝试运行 faac 的引导脚本但遇到错误

带变量的 bash 副本

objective-c - XCode 构建结果 : why is it so amazingly complex even for a hello world console app?

macos - 无法从终端使用 git

iphone - 创建自定义键盘并在您的 iPhone 上配置它

c++ - 不理解-c -o的Unix C++编译器