Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not a position-independent executable, can't convert to dylib. #9

Open
magicalccong opened this issue Jul 3, 2017 · 3 comments
Open

Comments

@magicalccong
Copy link

请问一下我出现了这个错误要怎么解决,文件取的是xx.app包里的二进制文件

@magicalccong
Copy link
Author

app2dylib supports armv7 and arm64 archtecture, but not support fat file. Please use lipo to thin the image file first. 不好意思,这个才对

@hellofrida
Copy link

需要瘦身 二进制文件。
比如瘦身armv7 设备。就用如下命令,还有arm64等
lipo -thin armv7 XXAPP -output XXAPP.armv7

@qokelate
Copy link

我写了个脚本转换

#!/bin/sh

src="$1"
dst="$2"
shift 2

if [ ! -f "$src" ]; then
	echo "usage: app2dylib.sh <src> <dst> [armv7 armv7s arm64 i386 x86_64]"
	exit
fi

if [ '' = "$1" ]; then
	"$0" "$src" "$dst" armv7 armv7s arm64 i386 x86_64
	exit
fi

param="lipo -create -o '$dst'"
for a in "$@"; do
	lipo -thin "$a" "$src" -o "$src.$a" 2>/dev/null
	[ -f "$src.$a" ] && app2dylib "$src.$a" -o "$src.$a.dylib"
	[ -f "$src.$a.dylib" ] && param="${param} '$src.$a.dylib'"
done

eval "$param"

for a in "$@"; do
	rm -f "$src.$a"
	rm -f "$src.$a.dylib"
done

lipo -info "$dst"

exit

使用方法: app2dylib.sh <源文件> <目标文件> <要转换的架构列表>

例如: app2dylib.sh /tmp/1.exe /tmp/1.dylib arm64 armv7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants