cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Adding static libcurl.a to xcode 7.2 example project adds libcurl.4.dylib dependency

From: Stephen Greenfield <StephenG_at_screenplay.com>
Date: Mon, 22 Feb 2016 23:01:28 +0000

On 2/22/16, 1:47 PM, "curl-library on behalf of Daniel Stenberg"
<curl-library-bounces_at_cool.haxx.se on behalf of daniel_at_haxx.se> wrote:

Daniel,

Thanks for your help here.

>If you need sudo to run those commands, you did something wrong already
>before
>that point. Like extracted the tarball as root or you did a previous
>build as
>root.

     /usr/local/lib has permissions for System = Read & Write, wheel =
Read only, and Everyone = Read only. Since I'm building from curl-7.47.1
which is in my own user, stephen, I'm guessing that's why. I'm an admin,
though…

>But I also note that you didn't run just plain 'make' there?

OK, right you are. I've done all this from scratch:

     export MACOSX_DEPLOYMENT_TARGET="10.8"
     sudo make clean
     ./configure --disable-share --with-darwinssl
     sudo make
     sudo make install

>And after you've ran 'make', you find a libcurl.a in the lib/.libs/ dir,
>right?

Yes — these three libcurl.* files in that location:

     -rw-r--r-- 1 root staff 572920 Feb 22 14:13 lib/.libs/libcurl.a
     lrwxr-xr-x 1 root staff 13 Feb 22 14:13 lib/.libs/libcurl.la
-> ../libcurl.la
     -rw-r--r-- 1 root staff 964 Feb 22 14:13 lib/.libs/libcurl.lai

> libcurl.a provides all the same symbols that libcurl.4.dylib does. If
>you end
> up using libcurl.4.dylib anyway, it is probably because you use the
>wrong link
> command.

This is Xcode's link command line from the copy of Apple's
"ViewController.app" OS X Cocoa example, which I added libcurl.a to:

     Ld
DerivedData/Build/Products/Debug/ViewController.app/Contents/MacOS/ViewCont
roller normal x86_64
     cd "/Users/stephen/dev/Cocoa/Cocoa UI Examples/ViewController"
     export MACOSX_DEPLOYMENT_TARGET=10.8
     
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolch
ain/usr/bin/clang -arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develo
per/SDKs/MacOSX10.11.sdk -L/Users/stephen/dev/Cocoa/Cocoa\ UI\
Examples/ViewController/DerivedData/Build/Products/Debug -L/usr/local/lib
-F/Users/stephen/dev/Cocoa/Cocoa\ UI\
Examples/ViewController/DerivedData/Build/Products/Debug -filelist
/Users/stephen/dev/Cocoa/Cocoa\ UI\
Examples/ViewController/DerivedData/Build/Intermediates/ViewController.buil
d/Debug/ViewController.build/Objects-normal/x86_64/ViewController.LinkFileL
ist -mmacosx-version-min=10.8 -fobjc-link-runtime -lcurl -framework
CoreMedia -framework AVFoundation -framework AppKit -framework Quartz
-Xlinker -dependency_info -Xlinker /Users/stephen/dev/Cocoa/Cocoa\ UI\
Examples/ViewController/DerivedData/Build/Intermediates/ViewController.buil
d/Debug/ViewController.build/Objects-normal/x86_64/ViewController_dependenc
y_info.dat -o /Users/stephen/dev/Cocoa/Cocoa\ UI\
Examples/ViewController/DerivedData/Build/Products/Debug/ViewController.app
/Contents/MacOS/ViewController

Then immediately after building and running, I've used otool:

     otool -L ViewController.app/Contents/MacOS/ViewController
          ViewController.app/Contents/MacOS/ViewController:
               /usr/local/lib/libcurl.4.dylib (compatibility version
9.0.0, current version 9.0.0)
               
/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia
(compatibility version 1.0.0, current version 1.0.0)
               
/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation
(compatibility version 1.0.0, current version 2.0.0)
               
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
(compatibility version 45.0.0, current version 1404.32.0)
               
/System/Library/Frameworks/Quartz.framework/Versions/A/Quartz
(compatibility version 1.0.0, current version 1.0.0)
               
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
(compatibility version 300.0.0, current version 1256.1.0)
               /usr/lib/libobjc.A.dylib (compatibility version 1.0.0,
current version 228.0.0)
               /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 1226.10.1)
               
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundati
on (compatibility version 150.0.0, current version 1256.14.0)

Stephen

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-02-23