root权限运行的app加载第三方动态库的问题

在以root权限运行的app中需要用到一个第三方提供的动态库,在把这个dylib添加到/opt/theos/lib/下面后,在应用程序的Makefile中添加了对其的链接,成功编译打包,安装到手机。(在手机上手动将这个dylib拷贝到了/usr/lib/下面)。
点击app运行的时候输出如下日志:

Mar 17 16:41:26 iPhone5 MobileMail[1032]: WiFi is associated YES
Mar 17 16:41:28 iPhone5 syncdefaultsd[1034]: MS:Notice: Injecting: com.apple.syncdefaultsd [syncdefaultsd] (1141.16)
Mar 17 16:41:28 iPhone5 syncdefaultsd[1034]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/TEGPS.dylib
Mar 17 16:41:28 iPhone5 syncdefaultsd[1034]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/introspy.dylib
Mar 17 16:41:28 iPhone5 syncdefaultsd[1034]: Introspy - Profiling disabled for com.apple.syncdefaultsd
Mar 17 16:41:29 iPhone5 syncdefaultsd[1034]: (Note ) SYDAccount: no account
Mar 17 16:41:29 iPhone5 syncdefaultsd[1034]: (Note ) SYDPIMAccount: no account (null)
Mar 17 16:41:29 iPhone5 syncdefaultsd[1034]: (Note ) SYDAlwaysOnAccount: no account (null)
Mar 17 16:41:29 iPhone5 syncdefaultsd[1034]: (Note ) marked "com.me.keyvalueservice" topic as "ignored" on (null)
Mar 17 16:41:39 iPhone5 mediaserverd[105]: '' (pid = 1025) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Mar 17 16:41:46 iPhone5 backboardd[1013]: MultitouchHID: detection mode: 6->3
Mar 17 16:41:46 iPhone5 sharingd[136]: 16:41:46.879 : Stopping Handoff scanning
Mar 17 16:41:46 iPhone5 wirelessproxd[162]: (Error) trying to stop a scan while the central isn't available
Mar 17 16:41:46 iPhone5 lockdownd[114]: 002c9000 set_response_error: handle_get_value GetProhibited
Mar 17 16:41:46 iPhone5 locationd[101]: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Mar 17 16:41:51 iPhone5 SpringBoard[1015]: LICreateIconForImage passed NULL CGImageRef image
Mar 17 16:41:51 iPhone5 locationd[101]: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: MS:Notice: Injecting: (null) [ReportCrash] (1141.16)
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/RocketBootstrap.dylib
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: MS:Notice: Loading: /Library/MobileSubstrate/DynamicLibraries/introspy.dylib
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: Introspy - Profiling disabled for (null)
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: task_set_exception_ports(B07, 400, F03, 0, 0) failed with error (4: (os/kern) invalid argument)
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: ReportCrash acting against PID 1039
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: Formulating crash report for process PacketCaptureDemo001[1039]
Mar 17 16:41:51 iPhone5 com.apple.xpc.launchd[1] (UIKitApplication:com.yourcompany.packetcapturedemo001[0x134b][1039]): Service exited due to signal: Trace/BPT trap: 5
Mar 17 16:41:51 iPhone5 ReportCrash[1042]: Saved report to /Library/Logs/CrashReporter/PacketCaptureDemo001_2015-03-17-164151_iPhone5.ips
Mar 17 16:41:51 iPhone5 SpringBoard[1015]: Application 'UIKitApplication:com.yourcompany.packetcapturedemo001[0x134b]' crashed.
Mar 17 16:41:51 iPhone5 locationd[101]: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
    /Library/Logs/CrashReporter/PacketCaptureDemo001_2015-03-17-164151_iPhone5.ips 下的崩溃日志如下:
{"bundleID":"com.yourcompany.packetcapturedemo001","app_name":"PacketCaptureDemo001","share_with_app_devs":false,"name":"PacketCaptureDemo001","app_version":"","is_first_party":true,"os_version":"iPhone OS 8.1.2 (12B440)","bug_type":"109","slice_uuid":"15567a86-44d4-32ec-b89e-e5c173a3b876","build_version":"1.0","adam_id":0}
Incident Identifier: 6FC414F6-191C-4A20-ACA5-689298F9E918
CrashReporter Key:   dcaf417a1be906ffdddba183c4131cf8a35d8c64
Hardware Model:      iPhone5,2
Process:             PacketCaptureDemo001 [1039]
Path:                /private/var/db/stash/_.pDSZup/Applications/PacketCaptureDemo001.app/PacketCaptureDemo001
Identifier:          com.yourcompany.packetcapturedemo001
Version:             1.0
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2015-03-17 16:41:51.594 +0800
Launch Time:         2015-03-17 16:41:51.237 +0800
OS Version:          iOS 8.1.2 (12B440)
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe
Triggered by Thread:  0

Dyld Error Message:
  Library not loaded: libmt.dylib
  Referenced from: /private/var/db/stash/_.pDSZup/Applications/PacketCaptureDemo001.app/PacketCaptureDemo001
  Reason: unsafe use of relative rpath libmt.dylib in /private/var/db/stash/_.pDSZup/Applications/PacketCaptureDemo001.app/PacketCaptureDemo001 with restricted binary
  Dyld Version: 353.6

Binary Images:
0x1fe67000 - 0x1fe8afff dyld armv7s  <8ffd813a380c333bbd4a25e1dbe05715> /usr/lib/dyld
0x248e0000 - 0x24c0dfff CoreFoundation armv7s  <5b54383b963a36369b45eaa35c3940be> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x24c0e000 - 0x24d38fff CoreGraphics armv7s  <7f8833bf31b33242b32bb893c5832f42> /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
0x25626000 - 0x25828fff Foundation armv7s  <6763b485b3b530f5ae7a6b8732110736> /System/Library/Frameworks/Foundation.framework/Foundation
0x27e9a000 - 0x2873cfff UIKit armv7s  <94d79df43f8a3b519b7fbf2ca102b4ea> /System/Library/Frameworks/UIKit.framework/UIKit
0x32196000 - 0x32390fff libobjc.A.dylib armv7s  <2f24d570e8253da29e77c4104a66ffff> /usr/lib/libobjc.A.dylib

如果App不以root权限运行,则能够正常加载。但是现在需要root权限。不知道这样的情况究竟是什么原因,求狗神指点。。。

貌似是因为,具体的原因你得google一下了
试试这个帖子用到的方法

google一番后,用install_name_tool 执行如下命令:

install_name_tool -id /usr/lib/libmt.dylib libmt.dylib

指定搜索路径,就可以成功加载了,这样执行

otool -L libmt.dylib

后得到的头信息就变成了:

libmt.dylib:
	/usr/lib/libmt.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1214.5.1)
    ... ...

而不是之前的:

libmt.dylib:
	libmt.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1214.5.1)
    ... ...

但是费解的是,没有用install_name_tool处理过的动态库在普通APP下是可以成功加载的,而在配置root权限的APP下就不行。不知道有没有大神知道是为什么?

我猜有可能是mobile和root权限的App对dylib的要求不一样

TEGPS.dylib是什么插件?