我试图将一组google boost库作为OS-X私有框架打包在一起,并且失败了。
我成功地在Mac(b2,bjam)上使用boosts build-tools来构建我需要的boost库的静态lib(.a)和动态lib(.dylib)版本。
我在Xcode中创建了一个框架目标(配置为私有框架)。我将它与我需要的7个dylib相关联,并设法将Headers复制到位,并将实际的dylib复制到框架的可执行文件目录中,以便将它们与新的“boost”框架结合在一起。
但是,框架的“顶级”动态库 - (在节食时命名为“boost”)不会导出这7个库中的任何符号。
所以我可以构建我的框架 - 但不能使用它。
我发现尝试自动(使用脚本)从boost创建一个iOS“框架”(带有内部静态库),但是这个脚本很旧,不适用于以后的boost版本,而且 - 它不是Xcode项目,只是一个脚本。
我试图找到如何通过我的“boost”动态库重新导出链接的.dylibs的符号,但无法理解如何。
想法有人吗?我真的很沮丧。
这是复杂的。您可以尝试,如果此构建脚本使您更接近解决方案:
好吧,不是没有汗水和眼泪,我终于得到了它的工作,这是涉及的技巧。在完成我在原始问题中提到的所有事情之后,您还必须:
boost_iostreams boost_locale boost_regex boost_signals boost_system boost_thread boost_filesystem
(这需要一天 - 为什么你需要删除“lib”和“.dylib”及其含义重新出口dylib)。Run Script - Fix boost dylibs
,并添加以下脚本(可能需要根据您放置boost构建目录的位置进行更改)#!/bin/bash
src_boost_dylib_dir=$SRCROOT/../../../boost_1_59_0_lib/dylib
dest_boost_dylib_dir=$CONFIGURATION_BUILD_DIR/$EXECUTABLE_FOLDER_PATH
boost_dylibs=( libboost_filesystem.dylib libboost_iostreams.dylib libboost_locale.dylib libboost_regex.dylib libboost_signals.dylib libboost_system.dylib libboost_thread.dylib)
for bdl in "${boost_dylibs[@]}"; do
echo Fixing boost dylib:$bdl
# at runtime, 'boost' loads its re-exported dylibs for other clients (such as AP) linked to boost. To find them, it must look in the same directory where boost is.
install_name_tool -id @loader_path/$bdl $src_boost_dylib_dir/$bdl
# make all dependent boost dylibs also relative to @loader_path, so that they can find each other in runtime.
dependencies=`otool -L $src_boost_dylib_dir/$bdl | grep "^\slibboost_" | awk -F' ' '{ print $1 }'`
for dependency_dylib in "${dependencies[@]}"; do
if [ "${dependency_dylib}" == "" ]; then
continue
fi
echo Dependency:$dependency_dylib
install_name_tool -change $dependency_dylib @loader_path/$dependency_dylib $src_boost_dylib_dir/$bdl
done
done
Run Script - Create symlink to reexported dylibs
的运行脚本阶段。添加以下脚本:# Create symlinks for all re-exported dylibs, at the framework's top level. They must be also relative to the framework directory.
cd $CONFIGURATION_BUILD_DIR/$WRAPPER_NAME
ln -Ffsv Versions/Current/libboost_*.dylib .
你应该完成。