diff mbox

[2/2] package/sconeserver: needs shared libs or non uClibc toolchain

Message ID 1472408394-20573-2-git-send-email-yann.morin.1998@free.fr
State Accepted
Commit a845798aa8af0535b85ea0e46cc9e8af9d1ffed1
Headers show

Commit Message

Yann E. MORIN Aug. 28, 2016, 6:19 p.m. UTC
sconeserver wants to use dlopen(), unconditionally: it does not try to
detect it, and it can't work without it (the code is not conditional).

So, when the toolchain uses uClibc, and that uClibc has been configured
with only static support, the dlopen() functions are not available at
all, and the corresponding headers are not present:

    ModuleLoader.cpp:29:19: fatal error: dlfcn.h: No such file or directory
     #include <dlfcn.h>
                       ^

However, we can't know if uClibc has shared support or is static-only,
especially for external toolchains.

The only way is to forbid the combination {uClibc,static}. So we may
indeed forbid working combinations, for example if the external
toolchain is uClibc-based and has support for shared libs...

Fixes:
    http://autobuild.buildroot.org/results/e92/e929799366e6f574c7b08d8635b18623afd3e3e1/

Reported-by: Matthew Weber <matt@thewebers.ws>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/sconeserver/Config.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Peter Korsgaard Aug. 28, 2016, 10:09 p.m. UTC | #1
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > sconeserver wants to use dlopen(), unconditionally: it does not try to
 > detect it, and it can't work without it (the code is not conditional).

 > So, when the toolchain uses uClibc, and that uClibc has been configured
 > with only static support, the dlopen() functions are not available at
 > all, and the corresponding headers are not present:

 >     ModuleLoader.cpp:29:19: fatal error: dlfcn.h: No such file or directory
 >      #include <dlfcn.h>
 >                        ^

 > However, we can't know if uClibc has shared support or is static-only,
 > especially for external toolchains.

 > The only way is to forbid the combination {uClibc,static}. So we may
 > indeed forbid working combinations, for example if the external
 > toolchain is uClibc-based and has support for shared libs...

Ehh, this I don't get. Why not simply depend on !BR2_STATIC_LIBS like we
do for other users of dlfcn.h?

If BR2_STATIC_LIBS is enabled then there won't be any .so files in the
target rootfs, so even if the C library has dlopen support it won't
work.

If an external (uClibc-based) toolchain has no shared library support
then it can only be used in BR2_STATIC_LIBS configurations.
Yann E. MORIN Aug. 28, 2016, 10:15 p.m. UTC | #2
Peter, All,

On 2016-08-29 00:09 +0200, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
>  > sconeserver wants to use dlopen(), unconditionally: it does not try to
>  > detect it, and it can't work without it (the code is not conditional).
> 
>  > So, when the toolchain uses uClibc, and that uClibc has been configured
>  > with only static support, the dlopen() functions are not available at
>  > all, and the corresponding headers are not present:
> 
>  >     ModuleLoader.cpp:29:19: fatal error: dlfcn.h: No such file or directory
>  >      #include <dlfcn.h>
>  >                        ^
> 
>  > However, we can't know if uClibc has shared support or is static-only,
>  > especially for external toolchains.
> 
>  > The only way is to forbid the combination {uClibc,static}. So we may
>  > indeed forbid working combinations, for example if the external
>  > toolchain is uClibc-based and has support for shared libs...
> 
> Ehh, this I don't get. Why not simply depend on !BR2_STATIC_LIBS like we
> do for other users of dlfcn.h?
> 
> If BR2_STATIC_LIBS is enabled then there won't be any .so files in the
> target rootfs, so even if the C library has dlopen support it won't
> work.

Not necessarily true.

One can use dlopen() to load "addons" even from a staticaly linked
executable.

However, I don't care about sconeserver; I was just looking at build
failures and trying to make it the least broken as possible.

If you're fine with making it depend on non static-only and drop the
uclibc condition, that's fine with me. ;-)

Regards,
Yann E. MORIN.

> If an external (uClibc-based) toolchain has no shared library support
> then it can only be used in BR2_STATIC_LIBS configurations.
> 
> -- 
> Bye, Peter Korsgaard
Matt Weber Aug. 28, 2016, 10:20 p.m. UTC | #3
Yann,

On Sun, Aug 28, 2016 at 1:19 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> sconeserver wants to use dlopen(), unconditionally: it does not try to
> detect it, and it can't work without it (the code is not conditional).
>
> So, when the toolchain uses uClibc, and that uClibc has been configured
> with only static support, the dlopen() functions are not available at
> all, and the corresponding headers are not present:
>
>     ModuleLoader.cpp:29:19: fatal error: dlfcn.h: No such file or directory
>      #include <dlfcn.h>
>                        ^
>
> However, we can't know if uClibc has shared support or is static-only,
> especially for external toolchains.
>
> The only way is to forbid the combination {uClibc,static}. So we may
> indeed forbid working combinations, for example if the external
> toolchain is uClibc-based and has support for shared libs...
>
> Fixes:
>     http://autobuild.buildroot.org/results/e92/e929799366e6f574c7b08d8635b18623afd3e3e1/
>
> Reported-by: Matthew Weber <matt@thewebers.ws>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  package/sconeserver/Config.in | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/package/sconeserver/Config.in b/package/sconeserver/Config.in
> index 4083aa7..5059570 100644
> --- a/package/sconeserver/Config.in
> +++ b/package/sconeserver/Config.in
> @@ -2,6 +2,7 @@ menuconfig BR2_PACKAGE_SCONESERVER
>         bool "sconeserver"
>         depends on BR2_INSTALL_LIBSTDCPP
>         depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> +       depends on !BR2_TOOLCHAIN_USES_UCLIBC || !BR2_STATIC_LIBS # dlopen()
>         select BR2_PACKAGE_PCRE
>         help
>           Sconeserver is a modular, object-orientated and extremely versatile
> @@ -103,4 +104,9 @@ comment "ui module requires X.org"
>  endif # BR2_PACKAGE_SCONESERVER

Should a comment be added for the toolchain C++ and NPTL are good but
dyn lib support is not?

comment "sconeserver needs a toolchain w/ dynamic library"
        depends on BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS_NPTL
        depends on BR2_TOOLCHAIN_USES_UCLIBC && BR2_STATIC_LIBS

I'd also be good with just disabling static build per follow on parts
of this thread.

Thanks,
Matt
Peter Korsgaard Aug. 29, 2016, 7:03 a.m. UTC | #4
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 >> Ehh, this I don't get. Why not simply depend on !BR2_STATIC_LIBS like we
 >> do for other users of dlfcn.h?
 >> 
 >> If BR2_STATIC_LIBS is enabled then there won't be any .so files in the
 >> target rootfs, so even if the C library has dlopen support it won't
 >> work.

 > Not necessarily true.

 > One can use dlopen() to load "addons" even from a staticaly linked
 > executable.

Generally speaking, yes - But not in Buildroot. We have a single global
BR2_STATIC_LIBS setting, so it is all or nothing.

 > However, I don't care about sconeserver; I was just looking at build
 > failures and trying to make it the least broken as possible.

 > If you're fine with making it depend on non static-only and drop the
 > uclibc condition, that's fine with me. ;-)

Ok, I'll adjust the patch and commit message and apply, thanks.
diff mbox

Patch

diff --git a/package/sconeserver/Config.in b/package/sconeserver/Config.in
index 4083aa7..5059570 100644
--- a/package/sconeserver/Config.in
+++ b/package/sconeserver/Config.in
@@ -2,6 +2,7 @@  menuconfig BR2_PACKAGE_SCONESERVER
 	bool "sconeserver"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || !BR2_STATIC_LIBS # dlopen()
 	select BR2_PACKAGE_PCRE
 	help
 	  Sconeserver is a modular, object-orientated and extremely versatile
@@ -103,4 +104,9 @@  comment "ui module requires X.org"
 endif # BR2_PACKAGE_SCONESERVER
 
 comment "sconeserver needs a toolchain w/ C++, NPTL"
-	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS_NPTL)
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || !BR2_STATIC_LIBS
+
+comment "sconeserver needs a toolchain with dynamic library, C++, NPTL"
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on BR2_TOOLCHAIN_USES_UCLIBC && BR2_STATIC_LIBS