make: 指定包的依赖位置

问题描述 投票:0回答:1

tldr:我怎么知道 make 拟使用 library.a 而不是在 /usr/local/Cellar/

我有两个c库(1和2)。我能够为所需的架构构建库1,我想为库2做同样的事情。库2依赖于库1。如果我为我的个人计算机构建库2,可能只需要简单地用brew安装库1,然后运行库2的构建脚本就可以了。然而,由于我也要为其他架构构建,所以不能这样做。

我已经成功创建了 library 1.a 文件,其中包含所有需要的架构,但我无法找到任何关于如何使 make 意识到它应该与这个文件有关。

for ARCH in ${ARCHS}
do
    if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then
        PLATFORM="iPhoneSimulator"
        EXTRA_CFLAGS="-arch ${ARCH}"
        EXTRA_CONFIG="--host=x86_64-apple-darwin"
    else
        PLATFORM="iPhoneOS"
        EXTRA_CFLAGS="-arch ${ARCH}"
        EXTRA_CONFIG="--host=arm-apple-darwin"
    fi

    mkdir -p "${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"

    ./configure --enable-float-approx --disable-shared --enable-static --with-pic --disable-extra-programs --disable-doc ${EXTRA_CONFIG} \
    --prefix="${INTERDIR}/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" \
    LDFLAGS="$LDFLAGS ${OPT_LDFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -L${OUTPUTDIR}/lib" \
    CFLAGS="$CFLAGS ${EXTRA_CFLAGS} ${OPT_CFLAGS} -fPIE -miphoneos-version-min=${MINIOSVERSION} -I${OUTPUTDIR}/include -isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk" \

    make -j4
    make install
    make clean
done

我在c方面的经验不是很丰富--我不认为这是一个很难实现的任务,但我根本不知道该怎么google。如果你能让我知道需要什么flagconfig或命令来引导。makelibrary 1.a 这将是非常有用的。

我没有发现 -L 标志,但是指定文件夹并没有用,它仍然说

configure: error: Package requirements (opus >= 1.1) were not met:

No package 'opus' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DEPS_CFLAGS
and DEPS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

我试过的方法是添加 export DEPS_LIBS=$HOME/Downloads/libopusenc/libopus.a 但还是一样。它是否也需要DEPS_CFLAGS中的一些东西?如果是的话,如果它需要的话,我可以在那里输入什么来使它 "不为空"?

我是否需要以某种方式直接指定库的名称和它要搜索的名称?

makefile static-libraries configure autotools
1个回答
0
投票

简单的做 export DEPS_CFLAGS=' ' 就足以让脚本跳过这一步。我现在确实遇到了其他的问题,但如果我从这里无法解决,我会开一个新的问题。

© www.soinside.com 2019 - 2024. All rights reserved.