diff mbox

[v2] qt: fix build for arm with BR2_STATIC_LIBS

Message ID 1444201366-354-1-git-send-email-alexander.lukichev@gmail.com
State Accepted
Headers show

Commit Message

Alexander Lukichev Oct. 7, 2015, 7:02 a.m. UTC
Some Buildroot-generated static toolchains for ARM do not have
dlfcn.h header, which breaks builds of qt-4.8.7 because its
QtCore's plugin loader expects this header to be present (and
dynamic libraries to be supported). For certain platforms without
dynamic libraries, there is a QT_NO_DYNAMIC_LIBRARY constant
defined in plugin loader's source. This patch puts that constant
into Qt's build environment if Buildroot is configured without
shared library support.

Fixes:
- http://autobuild.buildroot.net/results/11a4c19638ca211bd2a424fd92602166235c9433
- http://autobuild.buildroot.net/results/c056e8781558267f6971a5f017f47e90dcf24e07
- http://autobuild.buildroot.net/results/b8f34afa8686e890a1a3882a52081bb6a3b9c13b
and several others.

Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
---
Changes
v2: unnecessary Qt patch removed (Arnout).
---
 package/qt/qt.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Thomas Petazzoni Oct. 10, 2015, 10:03 a.m. UTC | #1
Dear Alexander Lukichev,

On Wed,  7 Oct 2015 10:02:46 +0300, Alexander Lukichev wrote:
> Some Buildroot-generated static toolchains for ARM do not have
> dlfcn.h header, which breaks builds of qt-4.8.7 because its
> QtCore's plugin loader expects this header to be present (and
> dynamic libraries to be supported). For certain platforms without
> dynamic libraries, there is a QT_NO_DYNAMIC_LIBRARY constant
> defined in plugin loader's source. This patch puts that constant
> into Qt's build environment if Buildroot is configured without
> shared library support.
> 
> Fixes:
> - http://autobuild.buildroot.net/results/11a4c19638ca211bd2a424fd92602166235c9433
> - http://autobuild.buildroot.net/results/c056e8781558267f6971a5f017f47e90dcf24e07
> - http://autobuild.buildroot.net/results/b8f34afa8686e890a1a3882a52081bb6a3b9c13b
> and several others.
> 
> Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
> ---
> Changes
> v2: unnecessary Qt patch removed (Arnout).
> ---
>  package/qt/qt.mk | 4 ++++
>  1 file changed, 4 insertions(+)

Applied, thanks.

Thomas
Peter Korsgaard Oct. 12, 2015, 8:38 p.m. UTC | #2
>>>>> "Alexander" == Alexander Lukichev <alexander.lukichev@gmail.com> writes:

 > Some Buildroot-generated static toolchains for ARM do not have
 > dlfcn.h header, which breaks builds of qt-4.8.7 because its
 > QtCore's plugin loader expects this header to be present (and
 > dynamic libraries to be supported). For certain platforms without
 > dynamic libraries, there is a QT_NO_DYNAMIC_LIBRARY constant
 > defined in plugin loader's source. This patch puts that constant
 > into Qt's build environment if Buildroot is configured without
 > shared library support.

 > Fixes:
 > - http://autobuild.buildroot.net/results/11a4c19638ca211bd2a424fd92602166235c9433
 > - http://autobuild.buildroot.net/results/c056e8781558267f6971a5f017f47e90dcf24e07
 > - http://autobuild.buildroot.net/results/b8f34afa8686e890a1a3882a52081bb6a3b9c13b
 > and several others.

 > Signed-off-by: Alexander Lukichev <alexander.lukichev@gmail.com>
 > ---
 > Changes
 > v2: unnecessary Qt patch removed (Arnout).
 > ---
 >  package/qt/qt.mk | 4 ++++
 >  1 file changed, 4 insertions(+)

 > diff --git a/package/qt/qt.mk b/package/qt/qt.mk
 > index e0e5d22..a64d32f 100644
 > --- a/package/qt/qt.mk
 > +++ b/package/qt/qt.mk
 > @@ -203,6 +203,10 @@ else
 >  QT_CONFIGURE_OPTS += -static
 >  endif
 
 > +ifeq ($(BR2_STATIC_LIBS),y)
 > +QT_CONFIGURE_OPTS += -D QT_NO_DYNAMIC_LIBRARY

Hmm, shouldn't this be checking BR2_PACKAGE_QT_STATIC instead?
Alexander Lukichev Oct. 13, 2015, 5:14 a.m. UTC | #3
Hi Peter,

On 10/12/2015 11:38 PM, Peter Korsgaard wrote:
>>>>>> "Alexander" == Alexander Lukichev <alexander.lukichev@gmail.com> writes:
>
>  > Some Buildroot-generated static toolchains for ARM do not have
>  > dlfcn.h header, which breaks builds of qt-4.8.7 because its
>  > QtCore's plugin loader expects this header to be present (and
>  > dynamic libraries to be supported). For certain platforms without
>  > dynamic libraries, there is a QT_NO_DYNAMIC_LIBRARY constant
>  > defined in plugin loader's source. This patch puts that constant
>  > into Qt's build environment if Buildroot is configured without
>  > shared library support.
[...]
>  > +ifeq ($(BR2_STATIC_LIBS),y)
>  > +QT_CONFIGURE_OPTS += -D QT_NO_DYNAMIC_LIBRARY
>
> Hmm, shouldn't this be checking BR2_PACKAGE_QT_STATIC instead?

I think, no. If BR2_PACKAGE_QT_STATIC means to compile only Qt
statically. The problem is when the whole platform is built with
static libraries (BR2_STATIC_LIBS). Then loading plugins dynamically
is not possible in principle. When the Buildroot build is not static,
some dynamic libraries (e.g., compiled later) may be put onto the
target system and be loaded by Qt, even if it itself is statically
built. Correct me if I'm wrong but I have not been able to confirm
that static Qt cannot load / work with dynamic libraries.

--
Best regards,
  Alexander Lukichev
diff mbox

Patch

diff --git a/package/qt/qt.mk b/package/qt/qt.mk
index e0e5d22..a64d32f 100644
--- a/package/qt/qt.mk
+++ b/package/qt/qt.mk
@@ -203,6 +203,10 @@  else
 QT_CONFIGURE_OPTS += -static
 endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
+QT_CONFIGURE_OPTS += -D QT_NO_DYNAMIC_LIBRARY
+endif
+
 ifeq ($(BR2_ENDIAN),"LITTLE")
 QT_CONFIGURE_OPTS += -little-endian
 else