Can't execute curl

12 ビュー (過去 30 日間)
Michael
Michael 2012 年 6 月 29 日
編集済み: Marianne Bezaire 2017 年 7 月 31 日
I'm using Matlab in a Unix environment.
The command curl "www.google.com" works very well in a shell.
If I try !curl "www.google.com" in matlab, I get :
curl: (48) An unknown option was passed in to libcurl
It seems that Matlab isn't sending directly the command I asked. Do you have any idea why this is happening?
Thanks
  4 件のコメント
Daniel Côté
Daniel Côté 2014 年 11 月 8 日
I found a much cleaner and simpler solution. Empty the dynamic library path before calling your function. This works well:
!DYLD_LIBRARY_PATH="";curl http://www.google.com
or
unix('DYLD_LIBRARY_PATH="";curl http://www.google.com');
The problem comes from the fact the when you call a shell command (with !, unix() or system() it does not matter) MATLAB sets up a dynamic library path that links to a bunch of MATLAB internal libs. Not too sure why (to give you access to their own libs?). Regardless of why that is, DYLD_LIBRARY_PATH is filled with links to dynamic libraries inside the MATLAB package that take precedence over the system (at least in my case on OS X with R2014b but I suspect everyone else's case too). Setting it to nothing ('') prevents the incorrect dynamic linking and programs still work (at least, curl still works). It appears much better that messing with the libraries directly.
I found out by using !env to get the environment of the running process.
Marianne Bezaire
Marianne Bezaire 2017 年 7 月 31 日
編集済み: Marianne Bezaire 2017 年 7 月 31 日
Daniel's solution above worked for me on Mac OS X
system(['!DYLD_LIBRARY_PATH=""' CommandToRun])

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by