【问题标题】:How to pass a custom script to ./configure to be run after the compiling?如何将自定义脚本传递给 ./configure 以在编译后运行?
【发布时间】:2020-02-29 15:05:42
【问题描述】:

我正在尝试在我越狱的 iOS 设备上构建 Tor 项目。我克隆了 Git 存储库,然后运行了 autogen.sh。接下来,我运行 ./configure,但没有找到 C 编译器。所以我改为运行它(在从 repos 安装 Clang、Theos Dependencies 等之后):

./configure CC="clang --isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk"

现在它说它不能运行 C 编译的程序:

PoisonImy:~/tor mobile$ ./configure CC="clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... no
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk
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... configure: error: in `/var/mobile/tor':               
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

这是因为我之前使用 Clang 编译一个 hello world 程序并尝试运行它时遇到“Killed: 9”错误。我使用 'ldid -SEntitlements.plist a.out' 修复了它,Entitlements.plist 文件位于here

有没有办法指示配置脚本(或 clang)做同样的事情?

编辑:也许制作一个运行 clang 和 ldid 的 shell 脚本,然后将其传递给配置脚本?我会试试这个。我是 shell 脚本的新手,所以我不知道如何解决这个问题。

【问题讨论】:

    标签: ios makefile clang configure


    【解决方案1】:

    完成。这是我使用的脚本:

    #!/bin/bash
    
    ALL="$*"
    
    while [[ $# -gt 0 ]]
    do
    key="$1"
    
    case $key in
        -o)
        OUTPUT="$2"
        shift
        shift
        ;;
        *)
        shift
        ;;
    esac
    done
    
    clang -isysroot /var/mobile/theos/sdks/iPhoneOS11.2.sdk ${ALL}
    ldid -S/var/mobile/Entitlements.plist ${OUTPUT}
    

    我将它保存为“compiler.sh”,使其可执行,并将其放入我的 PATH 中。然后我在配置脚本中将它用于我的编译器。您可能需要自行调整 SDK 目录和 Entitlements.plist 目录。

    【讨论】:

      猜你喜欢
      • 2017-11-04
      • 2018-08-22
      • 2017-05-03
      • 2011-12-29
      • 2020-12-17
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 2018-02-21
      相关资源
      最近更新 更多