[Libwebsockets] suggestion: Add include/libsockets.h link to build directory

Andy Green andy at warmcat.com
Sun Feb 26 09:01:09 CET 2017

On February 26, 2017 3:48:50 PM GMT+09:00, Per Bothner <per at bothner.com> wrote:
>On 02/25/2017 06:43 PM, Andy Green wrote:
>> On February 26, 2017 11:27:29 AM GMT+09:00, Per Bothner
><per at bothner.com> wrote:
>>> It would be helpful to be able to use the build directory "in-place"
>>> i.e. after 'make' but without 'make install'.
>> The main things that have led to it not being easy to use like that
>>  - binding the .so at runtime is usually a matter of ldconfig and
>/etc/ld.so.conf, implying copying the libs somewhere that's set up to
>look at
>At least on GNU/Linux, you can specify LD_LIBRARY_PATH to link (at
>against non-system libraries.
>>  - the test apps want assets in a /usr/share type place set at
>DomTerm uses the "where am I" library
>to find the executable, and uses ../lib or ../share relative to that.
>I make a point of the DomTerm build directory being set up so
>works teh asme way as after installation.

The test apps are already too bloated with this and that (except test-server-v2.0.c shrank compared to the originals).

>> I can imagine how to make the second fall back to looking at some ../
>dir also in build, but is your scheme going to be okay finding the libs
>at runtime like that as well as link-time?
>Since libwebsockets also builds libwebsockets.a, I decided it
>makes to use that, when building DomTerm against a non-installed

I think static linking is a reasonable way if no system lws library.

>if test "$with_libwebsockets" != "no"; then
>   case "${with_libwebsockets}" in
>     "yes" | "")
>       ;;
>     *)
>       #LIBWEBSOCKETS_LIBS="-L ${with_libwebsockets}/lib -lwebsockets"
>       LIBWEBSOCKETS_LIBS="${with_libwebsockets}/lib/libwebsockets.a"
>       LIBWEBSOCKETS_CFLAGS="-I${with_libwebsockets}/include"
>       ;;
>   esac
>This assumes an include link as I suggested, though I could replace
>   LIBWEBSOCKETS_CFLAGS="-I${with_libwebsockets}/../lib"
>for example.
>Using -I${with_libwebsockets}/include does seem more elegant though.

I also met this myself the other day with ESP32, it expects a dir it can -I to bring in the public includes for all of its "components"... I hacked one into existence in the build dir dynamically, but actually having one in the source tree directly would also be cleaner there.


More information about the Libwebsockets mailing list