英文:
readlink: illegal option -- f error in xcode
问题
I have readlink: illegal option -- f error when i'm trying to use product -> archive in xcode ..
我在尝试在Xcode中使用“product -> archive”时遇到了readlink: illegal option -- f错误。
i tried to remove the "-f" tag from source="$(readlink -f "${source}")" ... and got Rsync error: some files could not be transferred (code 23)
我尝试从source="$(readlink -f "${source}")"中删除"-f"标记,但出现了Rsync错误:一些文件无法传输(错误代码23)。
i tried to add this code to podfile but its not working
我尝试将这段代码添加到Podfile中,但不起作用。
post_install do |installer|
installer.pods_project.targets.each do |target|
shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
if File::exists?(shell_script_path)
shell_script_input_lines = File.readlines(shell_script_path)
shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
File.open(shell_script_path, 'w') do |f|
shell_script_output_lines.each do |line|
f.write line
end
end
end
end
}
post_install do |installer|
installer.pods_project.targets.each do |target|
shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
if File::exists?(shell_script_path)
shell_script_input_lines = File.readlines(shell_script_path)
shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
File.open(shell_script_path, 'w') do |f|
shell_script_output_lines.each do |line|
f.write line
end
end
end
end
end
注意:我使用的是Mac M1,应用在模拟器上运行良好。
英文:
i have readlink: illegal option -- f error when i'm trying to use product -> archive in xcode ..
i tried to remove the "-f" tag from source="$(readlink -f "${source}")" ... and got Rsync error: some files could not be transferred (code 23)
i tried to add this code to podfile but its not working
post_install do |installer|
installer.pods_project.targets.each do |target|
shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
if File::exists?(shell_script_path)
shell_script_input_lines = File.readlines(shell_script_path)
shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") }
File.open(shell_script_path, 'w') do |f|
shell_script_output_lines.each do |line|
f.write line
end
end
end
end
Note: i'm using mac m1 and the application works well on simulator
答案1
得分: 1
你是否在使用旧版本的 macOS?
这个命令在我的系统上运行正常:
# sw_vers
ProductName: macOS
ProductVersion: 13.4
BuildVersion: 22F66
# which readlink
/usr/bin/readlink
# ln -s /System FakeLink
# readlink -f FakeLink
/System
你可以尝试修改你的脚本,使用明确的路径 /usr/bin/readlink
,以防你意外地执行了某个名为 readlink 的脚本。
或者你可以安装 GNU readlink 并使用它:
brew install coreutils
ln -s /usr/local/bin/greadlink /usr/bin/readlink
英文:
It is that you are using an old version of macOS?
The command works ok on my system:
# sw_vers
ProductName: macOS
ProductVersion: 13.4
BuildVersion: 22F66
# which readlink
/usr/bin/readlink
# ln -s /System FakeLink
# readlink -f FakeLink
/System
You could try changing your script to use the explicit path /usr/bin/readlink
in case you are picking up some unexpected script called readlink.
Alternatively you could install the GNU readlink and use that
brew install coreutils
ln -s /usr/local/bin/greadlink /usr/bin/readlink
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论