configure: error: C compiler cannot create executables in mac os terminal

前端 未结 2 1994
遥遥无期
遥遥无期 2021-01-23 12:34

i\'m trying to Building libCURL in iOS 4.2, i do some steps in the terminal. The steps are :

  1. cd curl-7.21.2
  2. export CC=/Developer\\ 4.2/
相关标签:
2条回答
  • 2021-01-23 13:14

    The problem is the spaces in the pathnames. What's more, there isn't an easy fix until you remove them.

    The trouble is in the log file - it just appears near the middle of it...

    configure:4112: checking for C compiler version
    configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 --version >&5
    ./configure: line 4123: /Developer: is a directory
    configure:4132: $? = 126
    configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -v >&5
    ./configure: line 4123: /Developer: is a directory
    configure:4132: $? = 126
    configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -V >&5
    ./configure: line 4123: /Developer: is a directory
    configure:4132: $? = 126
    configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -qversion >&5
    ./configure: line 4123: /Developer: is a directory
    configure:4132: $? = 126
    configure:4151: checking whether the C compiler works
    configure:4173: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk  -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.c  >&5
    ./configure: line 4175: /Developer: is a directory
    configure:4177: $? = 126
    configure:4215: result: no
    

    To get the paths with the spaces to work, you'd have to be able to ensure that whenever CC is used, the path is enclosed in double quotes. You'd also have to fettle your CFLAGS value so that the path is not split but the -isysroot is separate from the path leading to -isysroot.

    If you want to get adventurous, you can try using:

    export CC="\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1\""
    export CFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk\""
    

    There's an outside chance it will work, but I'd not want to rely on it. Basically, it adds double quotes at judiciously selected points in the values of the environment variables, in the hope that the shell will manage to keep them in the right places. I don't think it will work, but it might be worth a try.

    I recommend renaming the path where you have the software installed without the space, maybe as:

    /Developer-4.2/Platforms/...
    

    (I had a directory $HOME/External Source Repositories briefly, with areas for git and svn and hg (Mercurial) copies of external source repositories, including the VCS's mentioned. The VCS were OK with the spaces in the names, but the build processes for the downloaded repositories (including the VCS own build systems) were not (git included, IIRC). The directory is now called $HOME/External-Source-Repositories instead.)

    0 讨论(0)
  • 2021-01-23 13:18

    If you are on Lion try installing with the tag: --with-gcc=clang

    Running rvm requirements explains this in more detail:

    Xcode 4.2:
     * is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
     * it breaks gems with native extensions, especially DB drivers.
    
    Xcode 4.2 users - please be warned - 
    in case of any compilation issues 
     * downgrade to Xcode 4.1
     * or install osx-gcc-installer
    and reinstall your rubies.
    
    0 讨论(0)
提交回复
热议问题