c++ - App run from Qt creator uses different library than when its run on its own -


i have use sftp upload files when application started run button qt creator works fine.

what found when run on own application returns error 1 curle_unsupported_protocol

checking curl on osx curl -v shows default curl not list sftp.

however somehow qt creator runs app in different context uses curl has support sftp, because uploads files without error.

so question how make standalone application uses same version of dylib when ran qt creator?

option a) change lib path

  • find application running using ps ax | grep <appname>
  • do otool -l <full-path-of-app>, give dylib app resolves to
  • change dylib in binary using install_name_tool. check answer more details point dylib used qt creator.

option b) [un]/set rpath

another reason app using incorrect path rpath on dylib. can check rpath on dylib using otool -l <full-path-of-your-app>. rpath tells location binary first pick libraries from, if set in application can unset rpath set qt creator.

check man page of dyld find out how rpath work.

for example check rpath set on xcode app (your looking lc_rpath field in dylib section).

$ otool -l /applications/xcode.app/contents/macos/xcode  load command 22           cmd lc_rpath       cmdsize 48          path @executable_path/../frameworks (offset 12) load command 23           cmd lc_rpath       cmdsize 56          path @executable_path/../sharedframeworks (offset 12) load command 24           cmd lc_rpath       cmdsize 40          path @executable_path/../plugins (offset 12) 

to unset rpath use install_name_tool -delete_rpath <rpath-from-otool-l-output>

qt creator typically uses libraries shipped package , on target system these typically not present. better thing compile curl , ship application


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -