Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Mobility Library Question on OS X



  • I am still struggling through trying to get mobility to work on OS X. I noticed that the documentation wants this command in your .profile file:

    @ LD_LIBRARY_PATH=$TARGET_DIR/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH@

    I understand the target directory, but what is the $LD_LIBRARY_PATH and how can I find it?



  • LD_LIBRARY_PATH is environment variable with paths of directories with libraries. It is usally empty and you can safely set it without concatenation, but sometime you have to set it repeatedly with two different paths and want them to be together in this list, in this case you should append old value of variable to the end of new value.



  • How can I know for sure what mine is?



  • If you are not sure about your LD_LIBRARY_PATH you can view it by using echo
    @
    echo $LD_LIBRARY_PATH
    @
    or simply use full variable setting
    @
    LD_LIBRARY_PATH=/some/path/here/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    @



  • If it would ever be possible to create an installer for Qt Mobility, it would be great.



  • On OS X the environment variable to set is DYLD_LIBRARY_PATH.

    LD_LIBRARY_PATH is for Linux (and probably some Unix systems too).

    [EDIT - fixed typo]



  • Interesting. I will try that. Shouldn't this be automated?



  • Automated? I don't understand....



  • It seems like with all of these problems that people are having with Mobility that some sort of installer would really be helpful.



  • Ah, ok. That's quite true. I never used it though I cannot comment further. I only stumbled over the (DY)LD_LIBRARY_PATH once I switched to the Mac :-)


  • Moderators

    Using that kind of concatenation of LD_LIBRARY_PATH is dangerous (at least in Linux). You really should make sure the LD_LIBRARY_PATH does not contain empty path elements ever.

    This is due to the loader evaluating LD_LIBRARY_PATH to find libraries an executable depends on. For some reason a empty path element (the thing between the ':' or ':' and the end of the string) is considered to be the current directory. So if you have LD_LIBRARY_PATH set to "/some/path::/some/other/path" then the loader will check the current directory for libraries. This is a security issue as anybody can make you run code for them if they can get you to start any executable while in a directory where they can put a library.

    As I said before: This is the case in Linux. I am not sure the MacOS loader behaves in the same way... So check before following this potentially dangerous advice.



  • This can prevent creating new empty paths:

    @
    if [ "x$DYLD_LIBRARY_PATH" = "x" ]; then
    export DYLD_LIBRARY_PATH="/path/to/my/lib"
    else
    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/my/lib"
    fi
    @



  • Again I would emphasize the great need for some sort of installer to minimize these risks. Perhaps adding it and all its dependencies to aptitude?



  • There is no aptitude in a standard Mac OS X installation.

    On a Debian or Ubunut box there might be already a package repository (known as PPA: Personal Package Archive), that can be added to apt/sources.list. I'm pretty sure they will be in the official repositories sometime the packages are sort-of stable.



  • Do you have any sort of general timeline idea of when that will happen?



  • Sorry, no. I'm neither into the planning of the Trolls on finishing Qt Mobility nor into that of Launchpad for their Ubuntu plans. I would not depend on anything you find on the net, unless it's from Launchpad or Nokia.



  • Can I add:

    @if [ "x$DYLD_LIBRARY_PATH" = "x" ]; then
    export DYLD_LIBRARY_PATH="/path/to/my/lib"
    else
    export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/my/lib"
    fi@

    directly to my .profile file and only change the two file paths?



  • Yes, you can. And additionally to .bashrc too.



  • Great to know, I will try it. Thanks.


Log in to reply