Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, April 2008
Linux deployment: static linking with standard C++ library


Message 1 in thread

I have a Linux deployment questions: How can i link my app statically with 
the standard C++ library  ( note that i built Qt as a static lib ) ?

In the documentation for "Deploying an Application on Qt/X11" whose file 
path is "/doc/html/deployment-x11.html"
In the Application Dependencies section it is stated that:
"This will list all the shared library dependencies for your application. 
Depending on configuration, these libraries must be redistributed along with 
your application. In particular, the standard C++ library must be 
redistributed if you're compiling your application with a compiler that is 
binary incompatible with the system compiler. When possible, the safest 
solution is to link against these libraries statically."

Any help appreciated. Thank you !




--
 [ signature omitted ] 

Message 2 in thread

Hello,

On Fri, Apr 25, 2008 at 10:41 AM, Maged Mokhtar <magedmokhtar@xxxxxxxxx> wrote:
>  I have a Linux deployment questions: How can i link my app statically with
>  the standard C++ library  ( note that i built Qt as a static lib ) ?

I haven't done this with the standard C++ library yet, but I did so
with libusb. I _guess_ it should work the same way for libstdc++. Just
add the .a file when linking. You can do this by simply adding it to
the LIBS variable without adding the -l prefix.

I'm doing it with this snipped in my .pro file (note that I use
-config static for a static build):

unix:static {
    # force statically linking of libusb. Use gcc to get its path.
    # if you have libusb.a in a non-standard lib path add it to
    # the INCLUDEPATH variable above.
    LIBS += $$system($$QMAKE_CC $$INCLUDEPATH -print-file-name=libusb.a)
}

If someone knows a nicer solution please let me know :)


 - Dominik

--
 [ signature omitted ] 

Message 3 in thread

On Friday 25 April 2008 22:08:26 Dominik Riebeling wrote:
> If someone knows a nicer solution please let me know :)

Not sure how to make this work in qmake (never used it) but you can ask ld to 
link to stattic library by:
"-Wl,-Bstatic -lMYLIBNAME"

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 4 in thread

On Sat, Apr 26, 2008 at 8:53 AM, Vladimir Pouzanov <farcaller@xxxxxxxxx> wrote:
> On Friday 25 April 2008 22:08:26 Dominik Riebeling wrote:
>  > If someone knows a nicer solution please let me know :)
>
>  Not sure how to make this work in qmake (never used it) but you can ask ld to
>  link to stattic library by:
>  "-Wl,-Bstatic -lMYLIBNAME"

That's how we are doing. Our pro-file looks something like this:
unix:!mac:release {
        LIBS += -Wl,-Bstatic $$BZIP2_LIBS $$KRB5_LIBS -Wl,-Bdynamic
$$SOUND_LIBS -lcom_err -lresolv
}

as Qt adds it's libraries last, we still dynamically as we end our
static libs with -Wl,-Bdynamic.

-- 
 [ signature omitted ] 

Message 5 in thread

thanks all for your help

"Robin Helgelin" <lobbin@xxxxxxxxx> wrote in message 
news:c014a9590804260114q7e2f62e5qbe5851d06fa3a395@xxxxxxxxxxxxxxxxx
> On Sat, Apr 26, 2008 at 8:53 AM, Vladimir Pouzanov <farcaller@xxxxxxxxx> 
> wrote:
>> On Friday 25 April 2008 22:08:26 Dominik Riebeling wrote:
>>  > If someone knows a nicer solution please let me know :)
>>
>>  Not sure how to make this work in qmake (never used it) but you can ask 
>> ld to
>>  link to stattic library by:
>>  "-Wl,-Bstatic -lMYLIBNAME"
>
> That's how we are doing. Our pro-file looks something like this:
> unix:!mac:release {
>        LIBS += -Wl,-Bstatic $$BZIP2_LIBS $$KRB5_LIBS -Wl,-Bdynamic
> $$SOUND_LIBS -lcom_err -lresolv
> }
>
> as Qt adds it's libraries last, we still dynamically as we end our
> static libs with -Wl,-Bdynamic.
>
> -- 
> regards,
> Robin
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/ 


--
 [ signature omitted ]