I just updated to Xcode 8, and I can no longer build xml2-based applications. If I build a simple file and try to build it as follows:
我刚刚更新到Xcode 8,我再也不能构建基于xml的应用程序了。如果我构建一个简单的文件并尝试按照以下方式构建它:
c++ myapp.cc `xml2-config --cflags` `xml2-config --libs`
...I get the following error message:
…我得到以下错误信息:
ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64
It doesn't matter what's in myapp.cc (mine is just a main routine that returns 0). The root problem seems to be that Apple removed /usr/lib/system/libsystem_symptoms.dylib in Xcode 8, but many of the .tbd files in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib still point to it. Has anyone else run into a problem like this?
在myapp中是什么都不重要。cc(我的只是一个返回0的主例程),根本问题似乎是苹果删除了/usr/lib/system/libsystem_symptom。在Xcode 8中的dylib,但是很多。tbd文件在/ application /Xcode.app/Contents/Developer/ platform/ MacOSX.platform/Developer/SDKs/MacOSX10.12。sdk/usr/lib仍然指向它。有人遇到过这样的问题吗?
6 个解决方案
#1
14
@mnencia answer works removing references to libsystem_symptomps.dylib, but failed for me using OS X. Change the following should allow it to work on OS X:
@mnencia answer将删除对libsystem_symptom的引用。dylib,但是我在使用OS X时失败了。
sudo /usr/bin/sed -i.backup -E -e 's@/usr/lib/system/libsystem_symptoms.dylib(, )?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
Hope this helps Mac developers.
希望这能帮助Mac开发者。
#2
3
This is an XCode 8 bug.
这是一个XCode 8错误。
While waiting for a proper fix from Apple, the following command removes the reference to the missing library from the tbd files.
在等待苹果的适当修复时,下面的命令从tbd文件中删除对丢失库的引用。
sudo /usr/bin/sed -i.backup 's@/usr/lib/system/libsystem_symptoms.dylib\(, \)\?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
I don't know if it will works for every kind of build, but it fixed everything was not working for me.
我不知道它是否适用于每一种建筑,但它固定了所有东西对我不起作用。
#3
3
Until Xcode8 stabilizes, I retain Xcode7.3, renamed as
在Xcode8稳定之前,我保留了Xcode7.3,并将其重命名为
/Applications/Xcode7.3.app/
/应用程序/ Xcode7.3.app /
Generally I use Xcode8 which is in
通常我使用Xcode8
/Applications/Xcode.app/
/应用程序/ xcode /
but when encountering errors such as this, I have the option to
但是当遇到这样的错误时,我可以选择
sudo xcode-select -switch /Applications/Xcode7.3.app/
sudo xcode-select开关/应用程序/ Xcode7.3.app /
This cured the error
这治愈的错误
ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64
ld:未找到的文件:/usr/lib/system/libsystem_symptom。建筑dylib x86_64
for me, when attempting to install an R package:
对于我来说,在尝试安装R包时:
> install.packages('clickstream')
> install.packages(“点击流”)
#4
2
One "fix" that I've used, which avoids any use of sudo, is simply to filter out the -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib flag. In a GNU makefile, this can be done with the filter-out command. So if I build a LINK_LIBS variable, which includes $(shell xml2-config --libs), then I can filter LINK_LIBS with the following command:
我所使用的一个“修复”,避免使用sudo,只是过滤掉-L/应用程序/Xcode.app/内容/开发人员/平台/MacOSX.platform/Developer/SDKs/MacOSX10.12。sdk / usr / lib国旗。在GNU makefile中,这可以通过过滤-out命令来完成。因此,如果我构建一个LINK_LIBS变量,它包含$(shell xml2-config——libs),那么我可以使用以下命令来过滤LINK_LIBS:
LINK_LIBS := $(filter-out -L$(shell xcrun --show-sdk-path)/usr/lib, $(LINK_LIBS))
If I'm just using xml2-config, I can also just add a "--exec-prefix=/usr" argument when calling it:
如果我只是使用xml2-config,我还可以在调用它时添加一个“-执行者-前缀=/usr”参数:
c++ myapp.cc `xml2-config --cflags` `xml2-config --exec-prefix=/usr --libs`
I don't know what potential side effects of removing the SDK path from the library search string might be, but for now, these solutions seem to work for all of my applications.
我不知道从库搜索字符串中删除SDK路径的潜在副作用是什么,但是现在,这些解决方案似乎适用于我所有的应用程序。
#5
1
@mnencia's answer almost worked for me, but the sed command didn't replace anything in the TLB files - the backups were the same as the modified files.
@mnencia的回答几乎对我起作用,但sed命令没有替换TLB文件中的任何内容——备份与修改后的文件相同。
I ran this part of his command: grep -ril /usr/lib/system/libsystem_symptoms.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
我运行了他的命令的这一部分:grep -ril /usr/lib/system/libsystem_symptom。dylib /应用程序/ xcode /内容/开发/平台/ MacOSX.platform /开发/ sdk / MacOSX10.12.sdk / usr / lib
Which identified the files referencing the removed library and modified them by hand.
标识引用已删除库的文件并手工修改它们。
YMMV
YMMV
#6
0
For anyone uncomfortable with stripping out references to libsystem_symptoms.dylib
from various locations, I came up with another solution that's the opposite of removing references -- adding a fake empty libsystem_symptoms.dylib
in /usr/lib/system
!
对于任何不喜欢删除libsystem_symptom引用的人。我从不同的位置找到了dylib,找到了另一种与删除引用相反的解决方案——添加一个假的空libsystem_symptom。在/usr/lib/system dylib !
mkdir ~/src/libempty
cd ~/src/libempty
touch empty.c
cc -dynamiclib empty.c -o libempty.dylib
sudo cp libempty.dylib /usr/local/lib/libempty.dylib
cd /usr/lib/system
sudo ln -s /usr/local/lib/libempty.dylib libsystem_symptoms.dylib
Except... that last step doesn't work because of OS X/macOS System Integrity Protection.
除了……由于OS X/macOS系统完整性保护,最后一步无法工作。
There's apparently more than one way of getting around that; you can disable it using csrutil
and rebooting (see the question Operation Not Permitted when on root El capitan). I don't really want to disable it (or forget to turn it back on), so I booted into recovery mode, and then opened a terminal window and finished the job this way:
显然有不止一种方法可以解决这个问题;您可以使用csrutil禁用它并重新启动它(参见在root El capitan上不允许的问题操作)。我不想禁用它(或者忘记打开它),所以我启动到恢复模式,然后打开一个终端窗口,以这种方式完成工作:
cd /Volumes
cd MyHardDrive
cd usr/lib/system
ln -s ../../local/lib/libempty.dylib libsystem_symptoms.dylib
Before doing this, I was trying to build PostgreSQL 9.6 on El Capitan, and was getting that linker error ("ld: file not found: /usr/lib/system/libsystem_symptoms.dylib"
) at the configure
step when it checked for the readline or zlib libraries. After doing this, PostgreSQL configured and built smoothly!
在进行此操作之前,我尝试在El Capitan上构建PostgreSQL 9.6,并在为readline或zlib库进行检查时,在配置步骤中获得了链接错误(“ld:文件未找到:/ usr/lib/system/libsystem_. dylib”)。完成此操作后,PostgreSQL配置并顺利构建!
#1
14
@mnencia answer works removing references to libsystem_symptomps.dylib, but failed for me using OS X. Change the following should allow it to work on OS X:
@mnencia answer将删除对libsystem_symptom的引用。dylib,但是我在使用OS X时失败了。
sudo /usr/bin/sed -i.backup -E -e 's@/usr/lib/system/libsystem_symptoms.dylib(, )?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
Hope this helps Mac developers.
希望这能帮助Mac开发者。
#2
3
This is an XCode 8 bug.
这是一个XCode 8错误。
While waiting for a proper fix from Apple, the following command removes the reference to the missing library from the tbd files.
在等待苹果的适当修复时,下面的命令从tbd文件中删除对丢失库的引用。
sudo /usr/bin/sed -i.backup 's@/usr/lib/system/libsystem_symptoms.dylib\(, \)\?@@' \
$(grep -ril /usr/lib/system/libsystem_symptoms.dylib \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib)
I don't know if it will works for every kind of build, but it fixed everything was not working for me.
我不知道它是否适用于每一种建筑,但它固定了所有东西对我不起作用。
#3
3
Until Xcode8 stabilizes, I retain Xcode7.3, renamed as
在Xcode8稳定之前,我保留了Xcode7.3,并将其重命名为
/Applications/Xcode7.3.app/
/应用程序/ Xcode7.3.app /
Generally I use Xcode8 which is in
通常我使用Xcode8
/Applications/Xcode.app/
/应用程序/ xcode /
but when encountering errors such as this, I have the option to
但是当遇到这样的错误时,我可以选择
sudo xcode-select -switch /Applications/Xcode7.3.app/
sudo xcode-select开关/应用程序/ Xcode7.3.app /
This cured the error
这治愈的错误
ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64
ld:未找到的文件:/usr/lib/system/libsystem_symptom。建筑dylib x86_64
for me, when attempting to install an R package:
对于我来说,在尝试安装R包时:
> install.packages('clickstream')
> install.packages(“点击流”)
#4
2
One "fix" that I've used, which avoids any use of sudo, is simply to filter out the -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib flag. In a GNU makefile, this can be done with the filter-out command. So if I build a LINK_LIBS variable, which includes $(shell xml2-config --libs), then I can filter LINK_LIBS with the following command:
我所使用的一个“修复”,避免使用sudo,只是过滤掉-L/应用程序/Xcode.app/内容/开发人员/平台/MacOSX.platform/Developer/SDKs/MacOSX10.12。sdk / usr / lib国旗。在GNU makefile中,这可以通过过滤-out命令来完成。因此,如果我构建一个LINK_LIBS变量,它包含$(shell xml2-config——libs),那么我可以使用以下命令来过滤LINK_LIBS:
LINK_LIBS := $(filter-out -L$(shell xcrun --show-sdk-path)/usr/lib, $(LINK_LIBS))
If I'm just using xml2-config, I can also just add a "--exec-prefix=/usr" argument when calling it:
如果我只是使用xml2-config,我还可以在调用它时添加一个“-执行者-前缀=/usr”参数:
c++ myapp.cc `xml2-config --cflags` `xml2-config --exec-prefix=/usr --libs`
I don't know what potential side effects of removing the SDK path from the library search string might be, but for now, these solutions seem to work for all of my applications.
我不知道从库搜索字符串中删除SDK路径的潜在副作用是什么,但是现在,这些解决方案似乎适用于我所有的应用程序。
#5
1
@mnencia's answer almost worked for me, but the sed command didn't replace anything in the TLB files - the backups were the same as the modified files.
@mnencia的回答几乎对我起作用,但sed命令没有替换TLB文件中的任何内容——备份与修改后的文件相同。
I ran this part of his command: grep -ril /usr/lib/system/libsystem_symptoms.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
我运行了他的命令的这一部分:grep -ril /usr/lib/system/libsystem_symptom。dylib /应用程序/ xcode /内容/开发/平台/ MacOSX.platform /开发/ sdk / MacOSX10.12.sdk / usr / lib
Which identified the files referencing the removed library and modified them by hand.
标识引用已删除库的文件并手工修改它们。
YMMV
YMMV
#6
0
For anyone uncomfortable with stripping out references to libsystem_symptoms.dylib
from various locations, I came up with another solution that's the opposite of removing references -- adding a fake empty libsystem_symptoms.dylib
in /usr/lib/system
!
对于任何不喜欢删除libsystem_symptom引用的人。我从不同的位置找到了dylib,找到了另一种与删除引用相反的解决方案——添加一个假的空libsystem_symptom。在/usr/lib/system dylib !
mkdir ~/src/libempty
cd ~/src/libempty
touch empty.c
cc -dynamiclib empty.c -o libempty.dylib
sudo cp libempty.dylib /usr/local/lib/libempty.dylib
cd /usr/lib/system
sudo ln -s /usr/local/lib/libempty.dylib libsystem_symptoms.dylib
Except... that last step doesn't work because of OS X/macOS System Integrity Protection.
除了……由于OS X/macOS系统完整性保护,最后一步无法工作。
There's apparently more than one way of getting around that; you can disable it using csrutil
and rebooting (see the question Operation Not Permitted when on root El capitan). I don't really want to disable it (or forget to turn it back on), so I booted into recovery mode, and then opened a terminal window and finished the job this way:
显然有不止一种方法可以解决这个问题;您可以使用csrutil禁用它并重新启动它(参见在root El capitan上不允许的问题操作)。我不想禁用它(或者忘记打开它),所以我启动到恢复模式,然后打开一个终端窗口,以这种方式完成工作:
cd /Volumes
cd MyHardDrive
cd usr/lib/system
ln -s ../../local/lib/libempty.dylib libsystem_symptoms.dylib
Before doing this, I was trying to build PostgreSQL 9.6 on El Capitan, and was getting that linker error ("ld: file not found: /usr/lib/system/libsystem_symptoms.dylib"
) at the configure
step when it checked for the readline or zlib libraries. After doing this, PostgreSQL configured and built smoothly!
在进行此操作之前,我尝试在El Capitan上构建PostgreSQL 9.6,并在为readline或zlib库进行检查时,在配置步骤中获得了链接错误(“ld:文件未找到:/ usr/lib/system/libsystem_. dylib”)。完成此操作后,PostgreSQL配置并顺利构建!