【问题标题】:a configure's options such as "--extra-cflags" --- I am confused配置选项,例如“--extra-cflags” ---我很困惑
【发布时间】:2012-05-07 13:53:51
【问题描述】:
    # configure for i386 build
./configure \
--cc=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \
--as='gas-preprocessor.pl /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \
--sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk \
--extra-ldflags=-L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/system \
--target-os=darwin \
--arch=i386 \
--cpu=i386 \
--extra-cflags='-arch i386' \
--extra-ldflags='-arch i386' \
--prefix=compiled/i386 \
--enable-cross-compile \
--disable-armv5te \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-ffprobe \
--disable-doc

下面将为 i386 构建 ffmpeg 静态库。但我不知道选项的含义,例如“--extra-cflags”、“--extra-ldflags”、“--sysroot="、"--as="。

谁能告诉我这些选项是什么意思?我在哪里可以找到详细说明?

谢谢。我正在等待您的帮助。

【问题讨论】:

    标签: iphone ios macos configure


    【解决方案1】:

    您始终可以将configure 脚本作为configure --help 运行;它将打印一个使用说明和有关许多已接受参数的信息——通常,希望是感兴趣的特定于包的参数。

    也就是说,--extra-cflags 将为 C 编译器提供额外的命令行开关,--as 将提供汇编程序的路径,--sysroot 将提供备用安装目录,--extra-ldflags 将提供额外的标志对于链接器。这些都是相当先进的,你不太可能需要使用它们。

    【讨论】:

    • 谢谢 ernest ,我听从你的帮助。并找到理解这一点的方法。再次感谢。
    • 使用--extra-cflags和使用CLFAGS作为环境变量有什么区别吗? gcc 是否同时考虑到它们?
    • @Hashim 它们实际上是*额外的”。它们将添加到 CFLAGS 中定义的任何内容,而不是替换任何先前的定义。根据您的情况,它们可能是等效的,也可能不是。 “额外”标志可以轻松使用环境中已有的内容,然后添加更多内容。
    【解决方案2】:

    这是一个有趣的configure 脚本,因为通常的 Autoconf 使用环境变量来表示诸如 C 标志 (CFLAGS) 和 C 编译器位置 (CC) 之类的东西。例如:

    CC=/path/to/my/specific/gcc/version CFLAGS="-I/additional/include/dir -L/additional/library/dir" \
    ./configure --prefix=/installation/dir --host=cross-compiler-triplet-if-any \
    --enable-something --with-some-feature --disable-something-else
    

    【讨论】:

    • 问题中的情况在我看来就像交叉编译(可能是他们的模拟器 x86“iphone”),所以大概需要覆盖环境变量,这些变量提供了构建所需的设置主机,具有为目标构建所需的值。
    • 感谢 eepp 和克里斯·斯特拉顿。我知道这些选项现在是环境变量。我可以找到执行有关此配置的帮助的帮助。
    猜你喜欢
    • 2011-04-11
    • 1970-01-01
    • 2020-08-17
    • 2012-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多