[flext] problem with static linking flext on Linux

Thomas Grill gr at grrrr.org
Sun Apr 7 22:20:31 CEST 2013


Hi Ico,
in your build example you cited the following line of console output:

g++ -pthread -shared  -Wl,-S -L../../../pd/bin -L./libbuild/lib -o pd- 
linux/release-single/fluid~.pd_linux   pd-linux/release-single/ 
main.opp  ../../grill/trunk/flext/libbuild/lib/libflext-pd_s.a* - 
lfluidsynth -lflext-pd_s

Therein, -lflext-pd_s can never cause dynamic linking, because the  
file libflext-pd_s.a is not a shared library, but rather a static one  
(at least if it has been built using the flext build system).
There is no libflext-pd_s.so which a dynamic linker could refer to.

So, if the line would be
g++ -pthread -shared  -Wl,-S -L../../../pd/bin -L./libbuild/lib -o pd- 
linux/release-single/fluid~.pd_linux   pd-linux/release-single/ 
main.opp -L../../grill/trunk/flext/libbuild/lib -lfluidsynth -lflext- 
pd_s
(notice the -L../../etc.) linking should work as expected.
This is possible by using

LIBPATH=-L../../grill/trunk/flext/libbuild/lib sh ../../grill/trunk/ 
flext/build.sh pd gcc

without your modification "LIBS= ../../grill/trunk/flext/libbuild/lib/ 
libflext-pd_s.a*" in package.txt.

The subfolder name you use, libbuild/lib, lets me assume that you are  
not using the flext build system to build the flext binaries. Then of  
course, you could also end up with a  libflext-pd_s.so or whatever,  
but this is not as intended by me.

--
Thomas Grill
http://grrrr.org



Am 07.04.2013 um 21:18 schrieb Ivica Bukvic:

> The problem is that you can not in any shape or form disable dynamic  
> linking that is added at the end of the LIBS variable by the  
> build.sh script even if you declare your own custom static library  
> and even if you try to override LIBS variable in the package.txt  
> file. I will try the LIBPATH but I'm not sure that will work because  
> on Linux when you try to link a library, as far as I understand, it  
> has to have its location cached prior to compiling for linker to be  
> able to find it.
>
> The other problem is that I still don't know what kind of potential  
> problems would an external have by being compiled both against the  
> static and dynamic libraries the same time because the build script  
> does not allow me to easily remove the linking of the dynamic  
> library even if I have declared a static library (as explained above).
>
> On Apr 7, 2013 2:50 PM, "Thomas Grill" <gr at grrrr.org> wrote:
> Hi Ico,
> i still don't get the problem - since static and dynamic library  
> versions of flext have different names, so they cannot possibly be  
> confused by the build system.
> As i see it, an easy solution could be to point the flext build  
> system to the location of your build of the flext library, e.g. as in
>
> LIBPATH=-L../flext/pd-darwin/release-single sh ../flext/build.sh pd  
> gcc
>
> Does this solve the issue?
> gr~~~
>
> --
> Thomas Grill
> http://grrrr.org
>
>
>
> Am 07.04.2013 um 15:03 schrieb Ivica Bukvic:
>
>> I am trying not to require sudo access while building pd-l2ork deb  
>> and trying to include flext- dependent libs, so installing system- 
>> wide is not an option. The problem for me, however, is not  
>> necessarily that the flext installer is not finding the dynamic  
>> library but that it keeps trying to link it even though I've  
>> manually statically linked it. In other words, the suggested  
>> solution you have for OSX does not work because package.txt is read  
>> before LIBS variable is appended with -ldynamic lib.so, so  
>> package.txt can never truly (entirely) override it. I am also  
>> wondering if building an external that links both static and  
>> dynamic library is going to work on a system that does not have  
>> flext installed (even If it was successfully built on a dev system).
>>
>> Is there was a way to define a variable just like you have SHARED  
>> variable for the flext installer this would solve the problem (e.g.  
>> STATIC). Another way would be to simply have the installer read  
>> package.txt file after it has finished appending LIBS variable, so  
>> one could truly override LIBS variable that contains dynamic linker  
>> command.
>>
>> Another, more complicated solution would be to in addition to  
>> having LIBS override option to dynamically provide info to the  
>> package.txt whether the build is single, multi, or shared, so a  
>> manual LIBS entry would look like LIBS=<manual-path>/STATICLIB  
>> where the STATICLIB variable would be automatically converted at  
>> compile-time to an appropriate version of static library (single,  
>> multi, etc).
>>
>> Any chance this could be implemented sometime soon? If so, it would  
>> make including flext externals in pd-l2ork Debian package a lot  
>> easier.
>>
>> Thanks!
>>
>> On Apr 7, 2013 6:58 AM, "Thomas Grill" <gr at grrrr.org> wrote:
>> Hi Ico,
>> i can't really remember what i wrote on the fluid~ topic. I guess  
>> that was years ago and the context might have changed in the  
>> meantime.
>> I think that your case should be easy to resolve.
>>
>> First, flext libraries libflext-pd_s.a or libflext-pd_t.a are  
>> always static, while libflext-pd.dylib is the shared version.
>> Consequently linking with the -lflext-pd_s option will always be  
>> static.
>>
>> In your console printout the libflext-pd_s.a is not found - most  
>> probably because it is not installed in any of the standard system  
>> locations (like /usr/local/lib).
>> Is there any reason why you haven't installed them? This is  
>> normally done by calling the flext build system with  "sudo sh  
>> build.sh pd gcc install" from the flext folder.
>>
>> hope this helps! all the best,
>> gr~~~
>>
>> --
>> Thomas Grill
>> http://grrrr.org
>>
>>
>>
>> Am 07.04.2013 um 08:21 schrieb Ivica Ico Bukvic:
>>
>>> Hey Thomas,
>>>
>>> Hope all is well. I followed some of your previous posts on this  
>>> topic that pertain to OSX and tried adjusting project.txt file for  
>>> a custom build of fluid~ external for pd but am having no luck in  
>>> suppressing -lflext-pd_* being tacked at the end of the build  
>>> process. Below are my packa.txt file and the output:
>>>
>>> NAME=fluid~
>>> PDPATH=../../../pd
>>> LIBS= ../../grill/trunk/flext/libbuild/lib/libflext-pd_s.a*
>>> CFLAGS+=-I../../grill/trunk/flext/source/
>>> BUILDDIR=build
>>> SRCDIR=fluid
>>> SRCS=main.cpp
>>>
>>> (I am trying to make the build as automated as possible, hence the  
>>> use of wildcard)
>>>
>>> The output is as follows:
>>>
>>>
>>> ico at zen:~/Downloads/PureData/pure-data/externals/footils/fluid 
>>> $ ../../grill/trunk/flext/build.sh pd gcc build
>>> make -f ../../grill/trunk/flext/buildsys/gnumake-sub.mak   
>>> PLATFORM=lnx RTSYS=pd COMPILER=gcc BUILDPATH=../../grill/trunk/ 
>>> flext/buildsys/ PKGINFO=package.txt BUILDCLASS=ext  
>>> USRCONFIG=config.txt USRMAKE=build/gnumake-lnx-gcc.inc  
>>> TARGETMODE=release TARGETTYPE=single _build_
>>> make[1]: Entering directory `/home/ico/Downloads/PureData/pure- 
>>> data/externals/footils/fluid'
>>> g++ -pthread -shared  -Wl,-S -L../../../pd/bin -L./libbuild/lib -o  
>>> pd-linux/release-single/fluid~.pd_linux   pd-linux/release-single/ 
>>> main.opp  ../../grill/trunk/flext/libbuild/lib/libflext-pd_s.a* - 
>>> lfluidsynth -lflext-pd_s
>>> /usr/bin/ld: cannot find -lflext-pd_s
>>> collect2: ld returned 1 exit status
>>> make[1]: *** [pd-linux/release-single/fluid~.pd_linux] Error 1
>>> make[1]: Leaving directory `/home/ico/Downloads/PureData/pure-data/ 
>>> externals/footils/fluid'
>>> make: *** [build-release-single] Error 2
>>>
>>> If I manually run the last line without lflext-pd_s, the external  
>>> builds properly and works just fine. Any pointers as to how I  
>>> could suppress the automatic dynamic linking done by flext build  
>>> system?
>>>
>>> Also, any suggestions how to make static linking reflect the kind  
>>> of build I wish to use (single/multi/etc.)?
>>>
>>> Please advise.
>>>
>>> -- 
>>> Ivica Ico Bukvic, D.M.A
>>> Composition, Music Technology
>>> Director, DISIS Interactive Sound & Intermedia Studio
>>> Director, L2Ork Linux Laptop Orchestra
>>> Head, ICAT IMPACT Studio
>>> Virginia Tech
>>> Department of Music
>>> Blacksburg, VA 24061-0240
>>> (540) 231-6139
>>> (540) 231-5034 (fax)
>>> disis.music.vt.edu
>>> l2ork.music.vt.edu
>>> ico.bukvic.net
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://grrrr.org/pipermail/flext/attachments/20130407/02fb4c05/attachment-0001.htm>


More information about the flext mailing list