On Mon, May 18, 2009 at 12:45 PM, Vivek Baindoor Rao <[email protected]> wrote:
> Thanks once again,
>
> I am using it on Fedora 10 Linux.
>
> The specific distribution is probably irrelevant here.
>
> Because my point was that if I built it using the CMake and try it - it runs 
> without the need for setting the
> LD_LIBRARY_PATH - whereas if I try my own automake based makefiles and build 
> it, it is unable to find the
> library unless I set the LD_LIBRARY_PATH - both on the same computer.

> So if the CMake can create a binary which is able to look for the library in 
> the /usr/local/lib at run time why is my makefile unable to do that please?  
> My guess is that my makefile is missing some option - either compile time or 
> link time.  I would like to know which option this is and use it.
>
> As I said earlier if I export the LD_LIBARY_PATH my automake makefile 
> generated binary works as well - but this would be an additional variable to 
> be taken care of when the actual binary is then transferred to the actual 
> target hardware - hence want to avoid the need for such an environment  
> variable
>
> CMake generated binary - is able to open library file at /usr/local/lib  - 
> but -
> Automake generated binary can not find the library unless the LD_LIBRARY_PATH 
> is exported to include that
> path - what is missing.

That's because by default CMake sets the RPATH (
http://en.wikipedia.org/wiki/Rpath_(linking) ).

You would have experienced the same problem if you had passed the
-DCMAKE_SKIP_RPATH:BOOL=1 parameter to CMake when you built Wt.

Building *without* RPATH is the recommended approach in Unix systems
(it's *mandatory* when building packages in Debian, for instance).
This is how I invoke CMake to build the Debian and Ubuntu packages:

cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=1 -DCONNECTOR_FCGI:BOOL=1
-DCMAKE_INSTALL_PREFIX:PATH=/usr -DCONFIGDIR:PATH=/etc/wt/
-DWT_CMAKE_FINDER_INSTALL_DIR:PATH=/share/cmake-2.6/Modules
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_SKIP_RPATH:BOOL=1
-DWEBUSER:STRING=www-data -DWEBGROUP:STRING=www-data ..)

Where $(CURDIR) is the build directory.

>
> -----Original Message-----
> From: Pau Garcia i Quiles [mailto:[email protected]]
> Sent: 18 May 2009 10:55
> To: [email protected]
> Subject: Re: [Wt-interest] Exploring possible use of Witty - but need to 
> getit to work with Automake based codebase
>
> Hello,
>
> There is nothing wrong. You have installed Wt in /usr/local/lib
> instead of /usr/lib and /usr/local/lib is not in your LD_LIBRARY_PATH
> (strage, but possible; what Linux distribution are you using?)
>
> You have to solutions:
>
> * Install Wt in /usr/lib. When invoking CMake to build Wt, pass this
> parameter: -DCMAKE_INSTALL_PREFIX:PATH=/usr
>
> * Add /usr/local/lib to the LD_LIBRARY_PATH. Add that directory to
> /etc/ld.so.conf. In modern distributions, the recommended approach is
> to add a new file containing that path in the /etc/ld.so.conf.d/
> directory. After that, run ldconfig. If you want the linker/exec
> loader to search that new path in other consoles, you may need to run
> ldconfig in those consoles (or reboot the system and you are done).
>
> On Mon, May 18, 2009 at 11:01 AM, Vivek Baindoor Rao <[email protected]> 
> wrote:
>> Thanks for the quick response.
>>
>> After further analysis I have the following situation:
>>
>> In my 'configure.ac' file I have:
>>
>>        PKG_CHECK_MODULES(DEPS, libwthttp-2.2.4 >= 0.0.1)
>>
>> So this results in DEPS_CFLAGS and DEPS_LIBS being defined for the
>> makefile generarion -  since
>> in my Automake based 'Makefile.am' file I have:
>>        INCLUDES = $(DEPS_CFLAGS)
>>        LDADD = $(DEPS_LIBS)
>>        AM_LDFLAGS = -rdynamic -Wl -lgd -lm -ljpeg -lpng12
>> -lboost_regex-mt -lboost_signals-mt -lz -lssl -lcrypto \
>>                         -lboost_thread-mt -lboost_filesystem-mt
>> -lboost_program_options-mt -lboost_date_time-mt
>>
>> The above line forces the libraries to be linked.
>>
>> The example program links correctly but when I try to run it I get the
>> following error:
>>
>> error while loading shared libraries: libwthttp.so.4: cannot open shared
>> object file: No such file or directory
>>
>> But the libwthttp.so.4 file is installed in /usr/local/lib directory and
>> I have created a libwthttp-2.2.4.pc file and the DEPS_CFLAGS and
>> DEPS_LIBS seem to be defined correctly since the linking goes through.
>>
>> Strangely if I export LD_LIBRARY_PATH=/usr/local/lib and run the same
>> binary it works without problems - in my analysis this is due to some
>> option being missed out/wrong during compilation and/or linking process
>> because the CMake based Makefile creates a binary which runs even when
>> the LD_LIBRARY_PATH is not exported.
>>
>>> Date: Fri, 15 May 2009 11:45:26 +0200
>>> From: Pau Garcia i Quiles <[email protected]>
>>> Subject: Re: [Wt-interest] Exploring possible use of Witty - but need
>>>       to get  it to work with Automake based codebase
>>> To: [email protected]
>>> Message-ID:
>>>       <[email protected]>
>>> Content-Type: text/plain; charset=windows-1252
>>>
>>> On Fri, May 15, 2009 at 11:25 AM, Vivek Baindoor Rao
>> <[email protected]> wrote:
>>> > Hi Witty members,
>>> >
>>> > At the moment exploring and evaluating different packages to provide
>> a ?Web
>>> > interface? for existing product with uses a lot of code written in
>> C++ but
>>> > managed by Autoconf and Automake set of tools.
>>> >
>>> > Having installed the Witty 2.2.4 on a Fedora10 system I find it hard
>> to get
>>> > the examples provided with the Wt package work using Automake.? I
>> have
>>> > created the configure.ac and Makefile.am files but the linking
>> options used
>>> > for creating the executable are a bit of a mystery for me.
>>> >
>>> > Can someone tell me how to find the proper options that need to be
>> given for
>>> > proper linking of the examples.
>>>
>>> I am not sure I have understood what you want.
>>>
>>> It should be easy:
>>> - You always need to link to libwt
>>> - If the example source code has any #include <Wt/Char/Whatever>, you
>>> need to link to libwtchart, too
>>> - If the example source code has any #include <Wt/Ext/Whatever>, you
>>> need to link to libwtext, too
>>> - If you want to deploy using the embedded webserver, link to
>>> liblwthttp. If you want to deploy using FastCGI, link to libwtfcgi.
>>>
>>> Please note you need to run the examples from the directory where the
>>> resources are. If you are not running "make install" for the examples,
>>> that means you need to run the examples from the directory where the
>>> source files are, not from where the binaries are.
>>>
>>> --
>>> Pau Garcia i Quiles
>>> http://www.elpauer.org
>>> (Due to my workload, I may need 10 days to answer)
>>
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables
>> unlimited royalty-free distribution of the report engine
>> for externally facing server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>
>
>
> --
> Pau Garcia i Quiles
> http://www.elpauer.org
> (Due to my workload, I may need 10 days to answer)
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.329 / Virus Database: 270.12.32/2119 - Release Date: 05/17/09 
> 16:58:00
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to