Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Do libraries I use need to be installed on every computer?

  1. #1
    Join Date
    Oct 2007
    Beans
    Hidden!

    Do libraries I use need to be installed on every computer?

    Hey everyone,

    Sorry in advance for this noobish question.

    Let's say I install the C++ boost libraries (or whatever library) and use them in an application I'm developing. I compile the code and distribute it online (or wherever). Would computers running my application also need to have the boost libraries installed?

    Thanks

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,240
    Distro
    Kubuntu

    Re: Do libraries I use need to be installed on every computer?

    Only if you link your application with the shared-object version of a particular library. If you link with the static library, then you would not.

    Shared-object libraries typically have a .so extension; static libraries have a .a extension (the 'a' denotes 'archive').

  3. #3
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Do libraries I use need to be installed on every computer?

    That's actually incredibly helpful, thanks a bunch!

  4. #4
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,240
    Distro
    Kubuntu

    Re: Do libraries I use need to be installed on every computer?

    Quote Originally Posted by mishathegoat View Post
    That's actually incredibly helpful, thanks a bunch!
    Things to keep in mind...

    1) Not every library has a static version; you may have a shared-object version, but not a static version.

    2) Linking a static library to your application will increase its "footprint"; in other words, the byte-size of the application will be larger than if merely linking against shared-object libraries. You probably will not see any difference with trivial/simple applications.

  5. #5
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Do libraries I use need to be installed on every computer?

    Hmmm, I see. Well, I would think the 'footprint' would be worth the extra size, this way the user could simply run the application without having to download any additional files. I don't normally (in Windows) download and run an application, only to have to go back online to download additional libraries.

  6. #6

    Re: Do libraries I use need to be installed on every computer?

    Quote Originally Posted by mishathegoat View Post
    I don't normally (in Windows) download and run an application, only to have to go back online to download additional libraries.
    That may be true for Windows, but in Ubuntu you do that all the time. Well, except for the "and run" part. It looks like this:

    Code:
    sudo apt-get install <package>
    apt-get automatically looks up the dependencies for <package>, including any runtime shared libraries it uses, and installs them for you. That's the primary advantage of using package managers.

    Even in Windows, many application installers automatically download and install some dependencies if they're not already available. DirectX comes to mind, although that's a terrible example because DirectX lives in its own little world of DLL hell.

    I'd advise going the dynamic (shared-object) route unless you have a compelling reason to link statically.

  7. #7
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Do libraries I use need to be installed on every computer?

    Thanks, trent.josephsen

    I already understood this was the case with most package managers. What makes these package managers so great, is the automatic resolving of dependencies.. But you're right, Windows doesn't work this way. I guess it would've been helpful to mention I prefer to make my applications cross-platform.

    I'm branching away from Java and I'd like to still easily "write once, run everywhere." I'm sure users wouldn't mind having a version of my application for each major OS

    Also, more people are likely to have DirectX, Flash, etc installed than some of the other incredibly-obscure packages I've seen some Linux applications require.

    Sorry for getting slightly off-topic, heh heh.

  8. #8
    Join Date
    Aug 2012
    Beans
    32

    Re: Do libraries I use need to be installed on every computer?

    Then just statically link when you build for Windows and dynamically link when building for Linux.

  9. #9

    Re: Do libraries I use need to be installed on every computer?

    Quote Originally Posted by durdenstationer View Post
    Then just statically link when you build for Windows and dynamically link when building for Linux.
    This is a viable and common solution.

  10. #10
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Do libraries I use need to be installed on every computer?

    Thanks guys, I'll keep that mind!

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •