2015-10-14 55 views
1

在Lion之前的OSX版本中,我使用/usr/X11路徑構建了X11應用程序。它在Tiger和Snow Leopard中運行良好。X11頭文件不在El Capitan 10.11 SDK中?

在Lion之後,又因爲我不再記得的原因(我相信它與避免來自不同SDK版本的頭部不匹配有關),我改變了這種方法並編譯了所有X11應用程序,避免使用/usr,而是使用: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.x.sdk(其中'MacOSX10.x.sdk'中的'x'是正在使用的SDK版本)。這種構建X11應用程序的方法在Mountain Lion和Yosemite中適用於我。

但是,現在我已將我的系統更新到El Capitan,並且X11應用程序配置腳本無法再使用-isysroot找到X11。

看,這就是我現在埃爾卡皮坦獲得,正是這樣,在山獅和約塞米蒂工作得很好相同:

creating cache ./config.cache 
checking whether to enable maintainer-specific portions of Makefiles... no 
checking for a BSD compatible install... /usr/bin/install -c 
checking whether build environment is sane... yes 
checking whether make sets ${MAKE}... yes 
checking for working aclocal-1.4... missing 
checking for working autoconf... missing 
checking for working automake-1.4... missing 
checking for working autoheader... missing 
checking for working makeinfo... found 
checking for gcc... gcc 
checking whether the C compiler (gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/X11R6/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11) works... yes 
checking whether the C compiler (gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/X11R6/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11) is a cross-compiler... no 
checking whether we are using GNU C... yes 
checking whether gcc accepts -g... yes 
checking how to run the C preprocessor... gcc -E 
checking for gcc option to accept ANSI C... none needed 
checking for Cygwin environment... no 
checking for mingw32 environment... no 
checking host system type... i386-apple-darwin15.0.0 
checking build system type... i386-apple-darwin15.0.0 
checking for ld used by GCC... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld 
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no 
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r 
checking for BSD-compatible nm... /usr/bin/nm 
checking for a sed that does not truncate output... /usr/bin/sed 
checking whether ln -s works... yes 
checking how to recognise dependent libraries... file_magic Mach-O dynamically linked shared library 
checking for object suffix... o 
checking for executable suffix... no 
checking command to parse /usr/bin/nm output... ok 
checking for dlfcn.h... yes 
checking for ranlib... ranlib 
checking for strip... strip 
checking for objdir... .libs 
checking for gcc option to produce PIC... -fno-common 
checking if gcc PIC flag -fno-common works... yes 
checking if gcc static flag -static works... no 
checking if gcc supports -c -o file.o... yes 
checking if gcc supports -c -o file.lo... yes 
checking if gcc supports -fno-rtti -fno-exceptions... yes 
checking whether the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes 
checking how to hardcode library paths into programs... unsupported 
checking whether stripping libraries is possible... no 
checking dynamic linker characteristics... darwin15.0.0 dyld 
checking if libtool supports shared libraries... yes 
checking whether to build shared libraries... no 
checking whether to build static libraries... yes 
creating libtool 
checking for executable suffix... (cached) no 
checking for byacc... no 
checking for flex... flex 
checking for flex... (cached) flex 
checking for yywrap in -lfl... no 
checking lex output file root... lex.yy 
checking whether yytext is a pointer... no 
checking for a BSD compatible install... /usr/bin/install -c 
checking whether ln -s works... (cached) yes 
checking whether make sets ${MAKE}... (cached) yes 
checking for X... no 

我不過是/usr/X11存在於我的系統中看到(它實際上指向/ opt/X11的鏈接,因爲El Capitan不允許/usr用於非Apple用戶,但/opt/X11正確無誤,包含所有X11標題和庫)。

這是否意味着X11應用程序無法與-isysroot一起構建?我是否需要使用系統根目錄包含路徑(它存在於/usr/include,順便說一下)構建它們? (我的系統甚至有/usr/include/stdio.h和所有的標準頭文件,我不知道爲什麼,因爲我相信所有的頭文件都被移到了SDK中)。

如果是肯定的,我不覺得有信心與包括/ usr/include目錄,而不是從SDK包含路徑......這讓我感到恐懼SDK的不匹配......

謝謝!

回答

1

不確定從SDK正確性的角度來看這個解決方案是否正確,但在10.11 El Capitan看來,設置'-isysroot'已經不足以編譯X11應用程序了。

因此,試圖用頭只從SDK,並與X11頭補充他們只(所以唯一的「外人」是X11頭),我發現,這個解決方案的工作原理:

的編譯

選項行:-I/opt/X11/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk的鏈接線

選項:-L/opt/X11/lib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

正如我所說的,我不知道這是做的正確的方式,但它(似乎)工作。我正在使用XQuartz 2.7.7,這是撰寫本文時的最新版本。

相關問題