Why are link default library dirs different from runtime default dirs?

I'm fairly new to Linux and Arch in particular. I've been trying to get around most issues by myself and I've been successful in general. In fact, I'm writing not so much because of a problem, but to better understand why the solution I found works, and if it is the right solution for my case.
So, I downloaded the source for a library I wanted to use (SFML if you're curious), built it and installed it. Looking around the net it seemed that the proper place to install things you compile yourself is /usr/local, so the libs went to /usr/local/lib. So far so good.
I then made a quick test application to make sure everything was working properly (source can be seen here: http://www.sfml-dev.org/tutorials/2.1/start-linux.php). It built correctly, but when I tried to run it I got an error that the library could not be found. So looking the error up in google, I found people saying you had to set the $LD_LIBRARY_PATH to the lib directory. In fact, at the end of the SFML tutorial it suggests this as well, but only if you install in a non-standard directory.
I found it odd that I should specify this variable. Had it been unset by something I did? Should I have set it before? I hadn't had to specify the directory when I built the program, which made it seem as though /usr/local/lib was a default directory. So why wasn't the library being found?
A bit more research uncovered that one should not in fact rely on $LD_LIBRARY_PATH for this, but instead you should specify it when building with -rpathDIR, so that the executable itself knows where to look. And indeed, setting this option when building fixed the issue.
My question then, is: why do I have to specify the library path for runtime, but not when building? Is it normal for usr/local/lib to not be searched, or did I break something in my install? Is GCC just trying to be helpful and tripping me up by looking in places that are reasonable for libraries to be, but that the system itself won't search?
Last edited by jp.garibotti (2014-02-09 20:14:54)

Well, after reading and getting to know the AUR a bit, at least I know why /usr/local/lib wasn't searched.
So, if I got it right, I have to use the AUR to download the build script to build a package. Then I use pacman to install that package. This sends the relevant binaries to where they need to go, which is where the system will look for them.
So as long as I stay inside the build system, everything will go fine.
If I don't build shared libraries myself, and limit myself to running my own executables, I shouldn't need to worry about the build system beyond this. If I ever want to send something I did to someone else, however, I need to create a package for them to build, which will have to work with whatever distribution package manager they have. Assuming I want to keep everything tidy.
There is one more thing I'm not clear on, though. So I installed the packages, headers are in /usr/include, but where should I place the sources? If I want to debug something and follow a call into the library, for example?

Similar Messages

  • Why are printer managed color prints different from Photoshop managed color prints using the same color profile?.

    I'm using Photoshop 13.0.1, Windows 7, to print images using custom color profiles made with an XRite colorimeter.  However, when I print the image using Printer Manages Color, it is not the same as Photoshop Manages the colors and selecting the Canon ICC profile that (Canon 7200 MP2) that is the same as the printer managed settings.  Why are these prints not the same if the same color profile is being accessed??

    Hi WA Veghe,
    >First: DO synchronize, makes sure you have the same profile settings and color mange settings.
    I don't seem to be able to synchronize between CS4 (Photoshop) and CS3 (Indesign).
    It seems I have to do without synchronizing..
    >I do not seem to find HOW you are diplaying images on you screen: with Soft proofing?
    What happens if you soft proof in Photoshop and InDesign on screen: View > Proof colors. Do you proof with the same profiles, both simulate paper and black on?
    I can simulate Proof Colors (working CMYK), but not simulate Paper, both in Indesign and Photoshop.
    Problem is: SAME settings in Photoshop and Indesign BUT the image displayed in Photoshop is brighter and more saturated.
    So which image should I correct after?
    thanks for all help
    /L

  • J1IEX - Available Credit quantity s different from the defaulted 0.000

    Hi All,
    We are doing the GR without reference to PO(501 Mvt type)  and then capturing excise in J1IEX.
    We get below warning message when we capture the excise invoice in J1IEX,
    "Available Credit quantity 12.000 is different from the defaulted 0.000!
    Message no. 4F285"
    Please help me to know, what does this mean and whether we can post the J1IEX.
    Regards,
    Praveen

    Hi
    check following link it may helpfull to you
    [J1IEX - Capture Excise Invoice without Purchase order.;
    Regards
    Kaials Ugale
    Note : Do not give links while answering queries.
    Edited by: Jeyakanthan A on Jul 11, 2011 12:44 PM

  • In the info bar at the bottom of the iphoto window, why is the number of items different from the total

    In the info bar at the bottom of the iphoto screen, why is the number of items different from the total?

    What version of iPhoto and system are you running? What mode are you in, i.e. Events, Photos?
    If it's the Photos mode the number at the bottom will represent the number of photos displayed in that mode or the number of photos selected in that mode. The number will match the number next to the photos mode only when there are no photos in that mode that are selected. 
    If you click on the Events icon and then back on the photos icon the numbers should match.
    OT

  • Why are there 3 library folders on my MB Pro?

    Why are there 3 library folders on my MB Pro? (1) in the HD folder; (2) in the system folder; (3) in the user folder?

    Your home/Library folder contains support and preference files for you. It includes all your mail, if you use Apple Mail, as well as things like contacts, calendars, Safari bookmarks and caches, and so on. It also includes any fonts which you have installed for your user. 20GB seems a little high, but if you have a lot of mail/attachments, this could explain it.
    The /Library folder contains support files (usually third-party) for all users. Adobe tends to put files in here, for example. It also includes iLife template/loop files, so you'll find GarageBand loops here, for example. Fonts which can be accessed by all users can be found here.
    The /System/Library folder belongs to OS X, and contains support files for the system.
    Don't delete any files from any of the folders unless you know what you're doing...
    Matt

  • Why is my iCloud address book different from my iMac address book?

    Why is my iCloud address book different from my iMac address book? How can I make everything the same?

    How is it different, does it contain duplicates, is it not syncing, please provide more information.

  • Why are my pinned top sites disappearing from the top sites page in Mavericks, after they have been pinned? Very appreciative of any help. This is making me crazy.

    Why are my pinned top sites disappearing from the top sites page in Mavericks, after being pinned? Any help would be greatly appreciated.

    Why are my pinned top sites disappearing from the top sites page in Mavericks, after being pinned? Any help would be greatly appreciated.

  • Why are application updates failing to install from application manager

    Why are application updates failing to install from application manager?

    Usually some update from another app is blocking any subsequent patches. The general cure is to run the Creative Suite Cleaner Tool, let the application manager reinstall and then let it try to update each application at the same time to prevent those version conflicts...
    Mylenium

  • Why is there a 5 people per day limit to local network shared library? (different from authorization)

    I'm in NYU library pulling on all-nighter, and because I enjoy listening to new musics (not necessarily newly released, but new-for-me musics), I would select and listen from one of the many shared libraries that are listed. If you use library almost everyday, you begin to notice some names that you have seen before. I clicked on the playlist, but there was an error message saying that only five people are allowed to listen per 24 hrs.
    Is there any way to turn this feature off? Why is a "shared" library limited to only five people per day? It's not like we are using it outside personal listening. And I would definitely like to see more than five people listening to my library per day.

    Ah ha! Result! I found this post related to problems with multicast DNS and wired/wireless connections (the situation I have): http://forum1.netgear.com/showthread.php?p=5612
    The latest firmware upgrade (http://kbserver.netgear.com/release_notes/d103043.asp) for the Netgear fixes the problem, and I can now see shared libraries. That router is very popular here in UK, not sure about elsewhere, so maybe others have the same problem.
    Cheers

  • Why are my pics being automatically rotated from landscape to potrait??

    Background: I use a Nikon D90. I have used a Windows machine up until this week, and never had this issue. I spoke with customer service for over an hour trying to resolve this issue, fail. I take pictures of guitars. Every single picture is a landscape picture. I have set Image Capture as my default program to import pictures. When I connect the camera, the program turns all the pictures of guitar necks to portraits. iPhoto did the same, I use Image Capture because I can set a destination for my import. This is the issue. _I want to import my pictures exactly how I take them, all in landscape._
    The windows machine never did this. I'm positive it isn't an issue with the camera. Out of all the pictures, it only does this with the guitar necks. I think the Mac is trying to "help" me by rotating my pictures for me. But they aren't pics of trees and they don't need rotated.
    What do you guys think?
    Can I attach a screenshot? I don't see an option...

    I've used windows machine in the past, with the same camera and a few different import programs, and have never had this issue before.
    Do those machines/programs support the auto-rotation feature of your camera? That is, if you take a picture in portrait orientation, do they show it rotated?
    I'm not sure why the images of the neck are rotated... if, as you say, you took this photo in landscape orientation, with the bottom of the camera toward the ground, then there's no reason for them to be rotated unless your camera has a feature to auto-rotate based on the image content. I'm not finding any documentation of such a feature in a Nikon D90, though I didn't look very thoroughly.
    One question: I can't tell from the photos, but it looks like the ones showing the issue could have been taken from above. If that's the case, this could be your problem. If you were shooting from above and took a picture of the body, then moved the camera, then took a picture of the neck, that could cause what I'm seeing. Keep in mind that your camera's accelerometer has no way of knowing that acceleration from movement is different from acceleration of gravity. Sliding your camera to the right on a rig might fool the camera into thinking it was rotated 90° counterclockwise, as shown in the photos of the front of the guitar, and sliding the camera to the left on a rig could make it think it was rotated 90° clockwise, as shown in the photos of the back of the guitar. With the camera pointing straight down, gravity would not re-orient the accelerometer as soon as the movement stopped.
    That's just a theory, I have no way of knowing whether the camera would actually behave as I describe.
    Is this question in the right forum?
    Probably... if you were using iPhoto, it would be better in the iPhoto forum, but you're using Image Capture, which makes it a little less clear-cut.

  • Library size differs from Vault size

    I just made a new Aperture Vault. My Aperture Library file is 41.66GB. My Vault file is 35.41GB.
    Why are these different?
    I have consolidated the library as well, so I am sure that the issue is not related to referenced files.
    Thanks,
    ~BC

    Thanks for that. Does my vault size (85% of the library size) seem about right to you?
    I only ask because the whole point of the vault is to be sure nothing is lost ... so I want to be sure I have this set up properly.
    Thanks,
    ~BC

  • Why are linked documents randomly out of sync with source docs?

    Regarding RoboHelp’s Link to Word feature…
    I have a RH 9 HTML project on my local drive with several hundred help topics that are “linked as references” from Word documents on a network drive. All was well until recently… several of the linked help topics are showing as “out of sync” even though the source documents have not be changed or moved. The out of sync topics all seem to be randomly picked, and when I update one topic to get things back in sync, another topic appears out of sync. It is not project specific, because I created a new project and created links to the same Word documents and the out of sync issue happened again. I tried removing the cpd file and opening up the project so that a new cpd file is generated, but the problem persists.
    Any thoughts on why this is happening? Is it some sort of connection issue?

    Hi, I understand about the mismatch…the problem is there shouldn’t be any mismatches, because the source documents didn’t change at all, and no updates were made to the html help topics in RoboHelp. The mismatches appear for no reason that I am aware of. They are very random and I can “fix” the mismatches by performing an “update” for a few linked topics, but then a few more mismatches randomly appear.
    I don’t use a Master Page…can you think of anything else I should look into?
    Thanks for your help.

  • Why are my contacts in icloud different to those on my iphone?

    Why are my contacts only partially downloaded to icloud and also in a different format? I want them to be exactly the same as on my iphone 4.

    Welcome to the Apple Community Rob.
    Please try the following…
        1.    First check that all your settings are correct, that contact syncing is checked on all devices (system preferences > iCloud on a mac and settings > iCloud on a iPhone, iPad or iPod).
        2.    Make sure the contacts you are adding are added to your 'iCloud' group and not an 'On My Mac', 'On My Phone' or other non iCloud group (you can do this by checking in groups), non iCloud contacts will not sync.
        3.    If you are sure that everything is set up correctly and your contacts are in the iCloud group, you might try unchecking contact syncing in the iCloud settings, restarting your device and then re-enabling contact syncing.

  • How are pre-named software tracks different from 'new' tracks ?

    We have these software tracks or audio tracks with names like Percussion , guitar , piano etc......how are these tracks different from a track which we make from menu as a new track ?
    Like we have various effect presets in guitar tracks is it so all these pre named tracks have some specific presets assigned ?
    or if I'm recording in a midi track it can be any name all the tracks have same parameters and a region will sound same in any of them effectwise ??

    All predefined instrument patches are having a set of suitable effects and filters assigned. YOu can see these in the "Info" panel, after you select an instrument your track. Click the "Edit" tab, and you will see, how the predfined patches differ.
    For a midi track, the sound generator will differ dependng on the instrument group, and some basic effects will be predefined, like "Compressor". YOu can click the empty bricks to add your own effects.

  • Why the image I get is different from the image I see on SpeedGrade???

    the image I get is different from the image I see on SpeedGrade???
    As the pic shows, the left one is what i get from speedgrade, and the right one is what i get after rending it out.

    Welcome to the world of the QuickTime Gamma Shift. In short: Apple is dispaying your video wrong. It actually happens with there own software (Final Cut Pro) as wel...
    Google for "QuickTime Gamma Shift" and see if you can find a workflow that works for you.

Maybe you are looking for

  • Help with Sleepwatcher display wake - 10.8.3?

    Hello all, I have installed Sleepwatcher using Macports on my 10.8.3 computer, following this guide pulled from this post (https://discussions.apple.com/message/17966344#17966344): MacPorts is one of the most effective and simplest ways to install Te

  • MacBook Pro goes to sleep, doesnt wake up!

    I recently bought a new MacBook Pro, and have noticed that this problem started since I downloaded a widget: Deep Sleep, which basically allows the Mac to go onto a Hibernate mode. I have uninstalled it now but the problem still persists, so I am not

  • Help! Icon present after update to iOS6.1

    Hi guys, After I made the update on my iPhone 4S to iOS 6.1 it seems that some times i have the connected icon present (like in the picture attached). I've checked everithing and it also appears when no app is active (I close them all) and also the b

  • How do I extract the data of Variant configuration into internal tables

    Hi Experts, How can I extract the data of variant configuration into an internal tables while preparing the report. Thanks, bsv.

  • Airdrop not showing

    Jut upgraded to Lion and Airdrop is not showing in my Finder window. Any ideas?