Apache httpd-2.4.9编译错误

时间:2014-06-02 20:43:06

标签: c xcode macos apache

我试图在mac osx 10.9上安装apache http server 2.4.9。我已经下载了gcc编译器。

sh-3.2# gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

我甚至安装了命令行工具

sh-3.2# pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1393561416
volume: /
location: /
install-time: 1401740485
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group 

但是当我尝试从源代码

编译apache 2.4.9时,我仍然收到以下错误
sh-3.2# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-apple-darwin13.1.0
checking host system type... x86_64-apple-darwin13.1.0
checking target system type... x86_64-apple-darwin13.1.0
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc"
  setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -E"
  setting CFLAGS to " "
  setting CPPFLAGS to " -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... yes
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/silango/appsrc/httpd-2.4.9':
configure: error: C compiler cannot create executables
See `config.log' for more details

2 个答案:

答案 0 :(得分:1)

MAC OS X 10.9已经内置了httpd模块,可以打开终端并输入以下命令:

开始:

sudo apachectl start

停止:

sudo apachectl stop

重新启动:

sudo apachectl restart

答案 1 :(得分:0)

您已降级Xcode命令行工具。我使用了4月10日的Mavericks版本并且它有效。