[SOLVED]Clean list of dependencies by ldd



  • Hello,

    How can I get clean list of dependencies by ldd?

    For example the default output of ldd is very dirty (in case I want to modify the output for adding cp) and I want to find a way for automatic or at least semi-automatic deployment procedure because adding these dependency manually by hand really exhausting process.
    @mbnoimi@mbnoimi-pc ~/Programs/synkron/x64 $ ldd ./synkron
    linux-vdso.so.1 => (0x00007fffcf7c5000)
    libQt5Widgets.so.5 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libQt5Widgets.so.5 (0x00007f9d5c73e000)
    libQt5Xml.so.5 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libQt5Xml.so.5 (0x00007f9d5c502000)
    libQt5Network.so.5 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libQt5Network.so.5 (0x00007f9d5c1ae000)
    libQt5Gui.so.5 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libQt5Gui.so.5 (0x00007f9d5bbae000)
    libQt5Core.so.5 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libQt5Core.so.5 (0x00007f9d5b576000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9d5b249000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9d5b033000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d5ac74000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9d5aa56000)
    libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f9d5a807000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f9d5a510000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f9d5a1d5000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9d59ed9000)
    libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f9d59c74000)
    libicui18n.so.49 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libicui18n.so.49 (0x00007f9d59a64000)
    libicuuc.so.49 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libicuuc.so.49 (0x00007f9d596de000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d594da000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f9d592d7000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9d590cf000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9d5cf61000)
    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f9d58ec6000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f9d58c89000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f9d58a6b000)
    libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f9d58844000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f9d58632000)
    libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f9d5842f000)
    libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f9d58228000)
    libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f9d58026000)
    libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f9d57e0f000)
    libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f9d57c08000)
    libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f9d579fc000)
    libicudata.so.49 => /home/mbnoimi/.Qt5.0.2/5.0.2/gcc_64/lib/libicudata.so.49 (0x00007f9d566db000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f9d564d7000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f9d562d0000)
    @



  • I use a python script that run's ldd and copy all required libs to deploy, then build a debian package of all solution ready to be install



  • [quote author="bjanuario" date="1370848078"]I use a python script that run's ldd and copy all required libs to deploy, then build a debian package of all solution ready to be install[/quote]

    May share us this script?!



  • Sorry,

    Was not python i meant, it's the ant tool.
    Please check the link: "http://ant.apache.org/manual/using.html":http://ant.apache.org/manual/using.html
    Here you can find examples about your needs



  • Sorry but this is real shallow answer, I know ANT and I used it in my java applications. If you can share use a real solution it should be fine, other than that this is not an answer has to be posted in this forum

    PS
    You answered me before on other posts in same way, you've to realize that most users here google and search inside the docs then ask their questions in case they didn't find a solution. I didn't face any one replied in your way here!!!



  • Sorry if i was unable to help you on other posts. Sometimes i try to help digging where i can found web examples, and that was the case.
    For the ant script I can show some part of mine, as seems u already know to build the xml:
    @ <target name="init-qtwebkit" depends="init" if="isLinux">

    <!--makes a copy of 32 or 64 bits QtWebKit files to the path that our projects are using for linking-->
    <exec dir="." executable="uname" outputproperty="command.ouput">
    <arg line="-m"/>
    </exec>
    <condition property="qtwebkitDirectory" value ="linux-amd64" else="linux-x86">
    <contains string="${command.ouput}" substring="_64"/>
    </condition>
    <echo message="QtWebKit source path will be thirdparty/qtwebkit/${qtwebkitDirectory}"/>

    <!--makes a copy of 32 or 64 bitsQtWebKit files to the path that our projects are using for linking-->
    <exec failonerror="true" executable="cp"><arg value="thirdparty/qtwebkit/${qtwebkitDirectory}/libqmlwebkitplugin.so"/><arg value="build/QtWebKit"/></exec>
    <exec failonerror="true" executable="cp"><arg value="thirdparty/qtwebkit/${qtwebkitDirectory}/qmldir"/><arg value="build/QtWebKit"/></exec>
    </target>

    <target name="init-imageformat" depends="init-qtwebkit" if="isLinux">

    <!--makes a copy of 32 or 64 bits imageformats files to the path that our projects are using for linking-->
    <exec dir="." executable="uname" outputproperty="command.ouput">
    <arg line="-m"/>
    </exec>
    <condition property="imageformatsDirectory" value ="linux-amd64" else="linux-x86">
    <contains string="${command.ouput}" substring="_64"/>
    </condition>
    <echo message="QtWebKit source path will be plugins/imageformats/${qtwebkitDirectory}"/>

    <!--makes a copy of 32 or 64 bitsQtWebKit files to the path that our projects are using for linking-->
    <exec failonerror="true" executable="cp"><arg value="plugins/imageformats/${qtwebkitDirectory}/libqjpeg.so"/><arg value="build/imageformats"/></exec>
    <exec failonerror="true" executable="cp"><arg value="plugins/imageformats/${qtwebkitDirectory}/libqgif.so"/><arg value="build/imageformats"/></exec>

    </target>
    <target name="init-sqldriver" depends="init-imageformat" if="isLinux">

    <!--makes a copy of 32 or 64 bits sqldrivers files to the path that our projects are using for linking-->
    <exec dir="." executable="uname" outputproperty="command.ouput">
    <arg line="-m"/>
    </exec>
    <condition property="psqlDirectory" value ="linux-amd64" else="linux-x86">
    <contains string="${command.ouput}" substring="_64"/>
    </condition>
    <echo message="Psql source path will be thirdparty/psql/${psqlDirectory}"/>

    <!--makes a copy of 32 or 64 bitsQtWebKit files to the path that our projects are using for linking-->
    <exec failonerror="true" executable="cp"><arg value="thirdparty/psql/${psqlDirectory}/libpq.so"/><arg value="thirdparty/psql/lib"/></exec>
    <exec failonerror="true" executable="cp"><arg value="thirdparty/psql/${psqlDirectory}/libpq.so.5"/><arg value="thirdparty/psql/lib"/></exec>
    <exec failonerror="true" executable="cp"><arg value="thirdparty/psql/${psqlDirectory}/libpq.so.5.4"/><arg value="thirdparty/psql/lib"/></exec>
    <exec failonerror="true" executable="cp"><arg value="plugins/sqldrivers/${psqlDirectory}/libqsqlpsql.so"/><arg value="build/sqldrivers"/></exec>
    </target>

    <target name="init-kdsoap" depends="init-sqldriver" if="isLinux">
    <!--makes a copy of 32 or 64 bitsffmpeg .so files to the path that our projects are using for linking-->
    <exec dir="." executable="uname" outputproperty="command.ouput">
    <arg line="-m"/>
    </exec>
    <condition property="kdsoapDirectory" value ="linux-amd64" else="linux-x86">
    <contains string="${command.ouput}" substring="_64"/>
    </condition>
    <echo message="kdsoap source path will be thirdparty/kdsoap/${kdsoapDirectory}"/>

    <!--makes a copy of 32 or 64 bitsffmpeg .so files to the path that our projects are using for linking-->
    <exec failonerror="true" executable="cp"><arg value="thirdparty/kdsoap/${kdsoapDirectory}/libkdsoap-server.so"/> <arg value="thirdparty/kdsoap/lib"/></exec>
    <exec failonerror="true" executable="cp"><arg value="thirdparty/kdsoap/${kdsoapDirectory}/libkdsoap-server.so"/> <arg value="thirdparty/kdsoap/lib"/></exec>
    <exec failonerror="true" executable="cp"><arg value="thirdparty/kdsoap/${kdsoapDirectory}/libkdsoap-server.so.1"/> <arg value="thirdparty/kdsoap/lib"/></exec>
    </target>@



  • [quote author="bjanuario" date="1370861855"]Sorry if i was unable to help you on other posts. Sometimes i try to help digging where i can found web examples, and that was the case.
    For the ant script I can show some part of mine, as seems u already know to build the xml:[/quote]

    What does this snippet do with ldd? nothing you still post in same way, nothing related at all!!!!!



  • Nothing at all !! U need to know what dependencies u need and write only once on build.xml. U use ldd once to see and u dont need to check all the time to build your solution



  • Hi, have you tried using cmake? I never really used it but apparently it recently improved with Qt to be easier to use, and from what I read it can be quite clever regarding dependencies. But if you're not already using it, I doubt changing the build system would be easier than just adding a few lines in your .pro file.

    If you are using QtCreator, you can right click in your .pro and select add library, it is not automatically importing everything but it may still help people that aren't used to qmake's syntax.

    If what you are after is only a GUI for that output, maybe "binscan":http://sourceforge.net/projects/binscan/ or "ELF Library Viewer":http://www.purinchu.net/software/elflibviewer.php can help.



  • bq. have you tried using cmake? I never really used it but apparently it recently improved with Qt to be easier to use, and from what I read it can be quite clever regarding dependencies

    Unfortunately, using cmake isn't option for me because I tried to use it and suffered from it because managing Qt project through it takes hell of time while using qmake much easier specially with QtCreator (auto completions, documentations, adding source+headers automatically.... etc)

    bq. If you are using QtCreator, you can right click in your .pro and select add library, it is not automatically importing everything but it may still help people that aren’t used to qmake’s syntax.

    This is absolutely incorrect because this feature built for adding libraies into Qt project and it's not related to deployment process... here I'm discussing ldd for auto or semi-auto deployment

    bq. If what you are after is only a GUI for that output, maybe binscan [sourceforge.net] or ELF Library Viewer [purinchu.net] can help.

    But... I read in ELF Library Viewer that there is better tool called Depspec although the point link is dead but you can find it on launchpad at "this link":https://launchpad.net/depspec as I read about it's the one but I'm still working on building it. After testing it I'll post the result here.



  • Voila :)

    "DepSpec":https://launchpad.net/depspec it's exactly what I'm looking for but it just shows the dependencies so all what I need to make it worthy is modifying it by adding save dependance tree to text file maybe I'll ask to maintainer or I'll do it by myself (I'm not so much familiar with Python as in C++)

    Any way, if you find a better solution can export the result of dependance to text file I'll be very thankful. Until that I'll not change this thread status to [SOLVED] until I finish it completely.

    Thank you guys :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.