Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure
@ 2016-02-28 23:16 Arnout Vandecappelle
  2016-02-29 11:27 ` Peter Korsgaard
  2016-02-29 21:49 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-02-28 23:16 UTC (permalink / raw)
  To: buildroot

The configure script tries to guess a lot based on the cpu for which it
is configured. Without --cpu, it will use a 'generic' cpu and disable
any other options we pass to it.

In addition, we have to pass the --sysroot option like we do in the
ffmpeg package. This makes sure that regardless of the architecture
options that ffmpeg passes along, an external multilib toolchain
doesn't try to use a subdirectory of the sysroot. The libav build
system will pass a --isysroot argument which overrides the multilib
subdir.

Finally, we have to properly enable/disable the architecture-specific
optimisations. Autodetection of these things is completely borked in
the configure script.

Fixes:
http://autobuild.buildroot.net/results/ce83513135e7765c171353815947d715eb897d3d

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
v2: improve commit message

The --isysroot is something we should probably do in the toolchain
wrapper.
---
 package/gstreamer1/gst1-libav/gst1-libav.mk | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/package/gstreamer1/gst1-libav/gst1-libav.mk b/package/gstreamer1/gst1-libav/gst1-libav.mk
index 3a987a7..97ff40f 100644
--- a/package/gstreamer1/gst1-libav/gst1-libav.mk
+++ b/package/gstreamer1/gst1-libav/gst1-libav.mk
@@ -10,7 +10,10 @@ GST1_LIBAV_SITE = http://gstreamer.freedesktop.org/src/gst-libav
 
 GST1_LIBAV_DEPENDENCIES = host-pkgconf gstreamer1 gst1-plugins-base
 
-GST1_LIBAV_CONF_EXTRA_OPTS = --cross-prefix=$(TARGET_CROSS) --target-os=linux
+GST1_LIBAV_CONF_EXTRA_OPTS = \
+	--cross-prefix=$(TARGET_CROSS) \
+	--target-os=linux \
+	--sysroot=$(STAGING_DIR)
 
 ifeq ($(BR2_PACKAGE_ZLIB),y)
 GST1_LIBAV_CONF_EXTRA_OPTS += --enable-zlib
@@ -26,6 +29,12 @@ else
 GST1_LIBAV_CONF_EXTRA_OPTS += --disable-bzlib
 endif
 
+ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
+GST1_LIBAV_CONF_EXTRA_OPTS += --cpu=$(BR2_GCC_TARGET_CPU)
+else ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
+GST1_LIBAV_CONF_EXTRA_OPTS += --cpu=$(BR2_GCC_TARGET_ARCH)
+endif
+
 ifeq ($(BR2_X86_CPU_HAS_MMX),y)
 GST1_LIBAV_CONF_EXTRA_OPTS += --enable-yasm
 GST1_LIBAV_DEPENDENCIES += host-yasm
@@ -74,6 +83,18 @@ else
 GST1_LIBAV_CONF_EXTRA_OPTS += --disable-altivec
 endif
 
+# Since we don't have architecture options for the DSP ASE, always disable
+GST1_LIBAV_CONF_EXTRA_OPTS += --disable-mipsdspr1 --disable-mipsdspr2
+
+# We don't have mips32r5
+GST1_LIBAV_CONF_EXTRA_OPTS += --disable-mips32r5
+
+ifeq ($(BR2_mips_64r6),y)
+GST1_LIBAV_CONF_EXTRA_OPTS += --enable-mips64r6
+else
+GST1_LIBAV_CONF_EXTRA_OPTS += --disable-mips64r6
+endif
+
 GST1_LIBAV_CONF_OPTS = \
 	--with-libav-extra-configure="$(GST1_LIBAV_CONF_EXTRA_OPTS)"
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure
  2016-02-28 23:16 [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure Arnout Vandecappelle
@ 2016-02-29 11:27 ` Peter Korsgaard
  2016-03-01 22:42   ` Arnout Vandecappelle
  2016-02-29 21:49 ` Peter Korsgaard
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Korsgaard @ 2016-02-29 11:27 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:

 > The configure script tries to guess a lot based on the cpu for which it
 > is configured. Without --cpu, it will use a 'generic' cpu and disable
 > any other options we pass to it.

 > In addition, we have to pass the --sysroot option like we do in the
 > ffmpeg package. This makes sure that regardless of the architecture
 > options that ffmpeg passes along, an external multilib toolchain
 > doesn't try to use a subdirectory of the sysroot. The libav build
 > system will pass a --isysroot argument which overrides the multilib
 > subdir.

 > Finally, we have to properly enable/disable the architecture-specific
 > optimisations. Autodetection of these things is completely borked in
 > the configure script.

 > Fixes:
 > http://autobuild.buildroot.net/results/ce83513135e7765c171353815947d715eb897d3d

 > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
 > ---
 > v2: improve commit message

 > The --isysroot is something we should probably do in the toolchain
 > wrapper.

What is the advantage of --isysroot over --sysroot? I don't seem to find
a lot about in the gcc documentation, but it seems like:

- isysroot only applied to headers, not headers+libraries like --sysroot
- Some versions of MacOSX/llvm only support --isysroot, not --sysroot

Neither of these seems of much interest to us?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure
  2016-02-28 23:16 [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure Arnout Vandecappelle
  2016-02-29 11:27 ` Peter Korsgaard
@ 2016-02-29 21:49 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2016-02-29 21:49 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:

 > The configure script tries to guess a lot based on the cpu for which it
 > is configured. Without --cpu, it will use a 'generic' cpu and disable
 > any other options we pass to it.

 > In addition, we have to pass the --sysroot option like we do in the
 > ffmpeg package. This makes sure that regardless of the architecture
 > options that ffmpeg passes along, an external multilib toolchain
 > doesn't try to use a subdirectory of the sysroot. The libav build
 > system will pass a --isysroot argument which overrides the multilib
 > subdir.

 > Finally, we have to properly enable/disable the architecture-specific
 > optimisations. Autodetection of these things is completely borked in
 > the configure script.

 > Fixes:
 > http://autobuild.buildroot.net/results/ce83513135e7765c171353815947d715eb897d3d

 > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
 > ---
 > v2: improve commit message

 > The --isysroot is something we should probably do in the toolchain
 > wrapper.
 > ---
 >  package/gstreamer1/gst1-libav/gst1-libav.mk | 23 ++++++++++++++++++++++-
 >  1 file changed, 22 insertions(+), 1 deletion(-)

 > diff --git a/package/gstreamer1/gst1-libav/gst1-libav.mk b/package/gstreamer1/gst1-libav/gst1-libav.mk
 > index 3a987a7..97ff40f 100644
 > --- a/package/gstreamer1/gst1-libav/gst1-libav.mk
 > +++ b/package/gstreamer1/gst1-libav/gst1-libav.mk
 > @@ -10,7 +10,10 @@ GST1_LIBAV_SITE = http://gstreamer.freedesktop.org/src/gst-libav
 
 >  GST1_LIBAV_DEPENDENCIES = host-pkgconf gstreamer1 gst1-plugins-base
 
 > -GST1_LIBAV_CONF_EXTRA_OPTS = --cross-prefix=$(TARGET_CROSS) --target-os=linux
 > +GST1_LIBAV_CONF_EXTRA_OPTS = \
 > +	--cross-prefix=$(TARGET_CROSS) \
 > +	--target-os=linux \
 > +	--sysroot=$(STAGING_DIR)

What does this do exactly? As far as I can see this only sets the
sysinclude_default variable (which apparently isn't used anywhere?) and
passes --sysroot / --isysroot to the compiler, which should be a noop
for us as we already do that in the wrapper.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure
  2016-02-29 11:27 ` Peter Korsgaard
@ 2016-03-01 22:42   ` Arnout Vandecappelle
  0 siblings, 0 replies; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-03-01 22:42 UTC (permalink / raw)
  To: buildroot

On 02/29/16 12:27, Peter Korsgaard wrote:
>>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:
> 
>  > The configure script tries to guess a lot based on the cpu for which it
>  > is configured. Without --cpu, it will use a 'generic' cpu and disable
>  > any other options we pass to it.
> 
>  > In addition, we have to pass the --sysroot option like we do in the
>  > ffmpeg package. This makes sure that regardless of the architecture
>  > options that ffmpeg passes along, an external multilib toolchain
>  > doesn't try to use a subdirectory of the sysroot. The libav build
>  > system will pass a --isysroot argument which overrides the multilib
>  > subdir.
> 
>  > Finally, we have to properly enable/disable the architecture-specific
>  > optimisations. Autodetection of these things is completely borked in
>  > the configure script.
> 
>  > Fixes:
>  > http://autobuild.buildroot.net/results/ce83513135e7765c171353815947d715eb897d3d
> 
>  > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>  > Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
>  > ---
>  > v2: improve commit message
> 
>  > The --isysroot is something we should probably do in the toolchain
>  > wrapper.
> 
> What is the advantage of --isysroot over --sysroot? I don't seem to find
> a lot about in the gcc documentation, but it seems like:
> 
> - isysroot only applied to headers, not headers+libraries like --sysroot
> - Some versions of MacOSX/llvm only support --isysroot, not --sysroot
> 
> Neither of these seems of much interest to us?

 I actually didn't do proper research, i.e. I didn't consult the man page. I
just tried:

$ .../ext-toolchain/bin/mips-img-linux-gnu-gcc --sysroot
.../usr/mips64el-buildroot-linux-gnu/sysroot -mabi=64 -EL -std=gnu99 -I./ -D...
-Os -march=mips64r6 -std=c99 -fomit-frame-pointer -fPIC -mips64 -mips64r6
-msched-weight -mload-store-pairs -funroll-loops -mhard-float ... -c
libavformat/4xm.c
In file included from ./libavutil/intreadwrite.h:22:0,
                 from libavformat/4xm.c:30:
/gentoo/home2/arnout/br-out/libav/host/opt/ext-toolchain/lib/gcc/mips-img-linux-gnu/4.9.2/include/stdint.h:9:26:
fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
$ .../ext-toolchain/bin/mips-img-linux-gnu-gcc --sysroot
.../usr/mips64el-buildroot-linux-gnu/sysroot --isysroot
.../usr/mips64el-buildroot-linux-gnu/sysroot -mabi=64 -EL -std=gnu99 -I./ -D...
-Os -march=mips64r6 -std=c99 -fomit-frame-pointer -fPIC -mips64 -mips64r6
-msched-weight -mload-store-pairs -funroll-loops -mhard-float ... -c
libavformat/4xm.c
$


 I was also surprised that this made a difference. Previously I had done a
-print-sysroot with all of these options and it added mipsel-r1-hard to the
sysroot, so somehow I assumed that isysroot would override that.

 So I ran with -v. With just --sysroot:

#include "..." search starts here:
#include <...> search starts here:
 .
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/include
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/include-fixed/mipsel-r6-hard/lib64
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include
End of search list.

 And with the --sysroot -isysroot:

#include "..." search starts here:
#include <...> search starts here:
.
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/include
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/include-fixed/mipsel-r6-hard/lib64
 .../opt/ext-toolchain/bin/../lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include
 .../usr/mips64el-buildroot-linux-gnu/sysroot/usr/include
End of search list.


 So clearly it does make a difference...

 So I tried with my host-gcc as well, and both gcc-4.9 and gcc-5 work as
expected, i.e. they have the --sysroot in the search path.

 So it looks like this is actually a "feature" of the Codescape IMG toolchain.



 Coming back to the patch: the idea of passing --sysroot to configure comes from
the ffmpeg package itself. It has been like that in the ffmpeg package from the
first commit.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-01 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-28 23:16 [Buildroot] [PATCH v2] gst1-av: fix cpu detection in libav configure Arnout Vandecappelle
2016-02-29 11:27 ` Peter Korsgaard
2016-03-01 22:42   ` Arnout Vandecappelle
2016-02-29 21:49 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox