[Qt-interest] soname for shared library
Girish Ramakrishnan
girish at forwardbias.in
Fri Apr 10 21:18:02 CEST 2009
Ah joy at last. It looks like 'plugin' in CONFIG is causing the problem.
You will notice that all Qt plugins do not have soname set either.
However, I had a look into qmake source, and there is a
plugin_with_soname. If I use plugin_with_soname in CONFIG, it works fine
(but this is undocumented afaict).
Anyone has an explanation for the above behavior?
Girish
P.S. CC'ing back the list.
Eric Berryman wrote:
> That is so strange ... I don't get the -soname part. I'm running qt
> from debian lenny.
>
> I even put in the last line of:
> QMAKE_LFLAGS_SONAME = -Wl,-soname,
>
> just in case.
>
> Does order matter?
>
> Thank you again!
>
>
> On Fri, Apr 10, 2009 at 2:56 PM, Girish Ramakrishnan
> <girish at forwardbias.in> wrote:
>> I have the following and it works for me.
>>
>> TEMPLATE = lib
>> VERSION = 5.2
>> TARGET = blender
>>
>> HEADERS += library.h
>> SOURCES += library.c
>>
>> When I compile I get,
>> gcc -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB
>> -DQT_CORE_LIB -DQT_SHARED
>> -I../../Qt/install/qt-x11-opensource-4.5.0/mkspecs/linux-g++ -I.
>> -I../../Qt/install/qt-x11-opensource-4.5.0/include/QtCore
>> -I../../Qt/install/qt-x11-opensource-4.5.0/include/QtGui
>> -I../../Qt/install/qt-x11-opensource-4.5.0/include -I. -I. -o library.o
>> library.c
>> rm -f libblender.so.5.2.0 libblender.so libblender.so.5 libblender.so.5.2
>> g++ -Wl,-O1
>> -Wl,-rpath,/home/girish/Qt/install/qt-x11-opensource-4.5.0/lib -shared
>> -Wl,-soname,libblender.so.5 -o libblender.so.5.2.0 library.o
>> -L/home/girish/Qt/install/qt-x11-opensource-4.5.0/lib -lQtGui
>> -L/home/girish/Qt/install/qt-x11-opensource-4.5.0/lib -L/usr/X11R6/lib
>> -pthread -lpng -lfreetype -lSM -lICE -pthread -pthread -lXrender
>> -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt
>> -lglib-2.0 -ldl -lpthread
>> ln -s libblender.so.5.2.0 libblender.so
>> ln -s libblender.so.5.2.0 libblender.so.5
>> ln -s libblender.so.5.2.0 libblender.so.5.2
>>
>> Do you have a "-Wl,-soname" as above in the linker line?
>>
>> Girish
>>
>> Eric Berryman wrote:
>>> Thank you!
>>>
>>> Does order matter? Because that doesn't seem to be working for me.
>>> Here is what I have below:
>>>
>>>
>>>
>>>
>>> unix:!macx {
>>> # message("PLATFORM: unix")
>>> DEFINES += LINUX FONTSIZE=9 FONTNAME=\'\"Sans Serif\"\' FONTWEIGHT=75
>>> EPICS_INCL_OS = Linux
>>> EPICS_LIB_OS = $(HOST_ARCH)
>>> }
>>>
>>> CONFIG += designer plugin thread release uitools
>>>
>>> TEMPLATE = lib
>>>
>>>
>>> QT += xml network
>>> QT += sql
>>>
>>> # Input
>>> HEADERS += xxxx.h
>>>
>>> SOURCES += xxxx.cp
>>>
>>> unix:!macx {
>>> target.path = $$PREFIX/usr/local/lib/
>>> sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS NSCLCommon.pro
>>> sources.path = ./
>>> INSTALLS += target
>>> }
>>>
>>> VER_MAJ = 5
>>> VER_MIN = 1
>>> VER_PAT = 1
>>> VERSION = $$VER_MAJ.$$VER_MIN.$$VER_PAT
>>> TARGET = NSCLCommon
>>>
>>>
>>> On Fri, Apr 10, 2009 at 2:42 PM, Girish Ramakrishnan
>>> <girish at forwardbias.in> wrote:
>>>> Eric Berryman wrote:
>>>>> Hello!
>>>>>
>>>>> What do I need to put in my .pro file to have qmake use -soname?
>>>>>
>>>>> I am using the lib template, and I would like the target to include
>>>>> the version i.e. lib<name>.so.1.2.
>>>>>
>>>>> I tried putting:
>>>>> VERSION = 1.2
>>>>> TARGET = $$TARGET_x.y.z
>>>>>
>>>>> this did not work.
>>>>>
>>>> The soname is automatically set based on VERSION. You will
>>>> -Wl,soname,xxx in the linker line. If you set TARGET to 'foo' and
>>>> VERSION to 1.2, it will create libfoo.so.1.2.0 (and 2 symlinks). The
>>>> shared object itself which will have the soname libfoo.so.1 (which you
>>>> can verify with readelf).
>>>>
>>>> Girish
>>>>
>>
More information about the Qt-interest-old
mailing list