* [Buildroot] [git commit] mpd: fix build on SPARC
@ 2016-02-07 21:02 Thomas Petazzoni
2016-02-11 11:12 ` Jörg Krause
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2016-02-07 21:02 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=84533029c70a4dffb2cd2e4f05e3903fd1b8fcd9
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
mpd uses __atomic_*() built-ins, but forgets to link with -latomic
when needed, so this commit adds a patch that ensures it will link
with libatomic, and adds a dependency on BR2_TOOLCHAIN_HAS_ATOMIC.
Fixes:
http://autobuild.buildroot.net/results/e2207280f3a177e12dba502b1c01f5aeb431d04c/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
...configure.ac-check-if-libatomic-is-needed.patch | 40 ++++++++++++++++++++++
package/mpd/Config.in | 2 ++
package/mpd/mpd.mk | 1 +
3 files changed, 43 insertions(+)
diff --git a/package/mpd/0005-configure.ac-check-if-libatomic-is-needed.patch b/package/mpd/0005-configure.ac-check-if-libatomic-is-needed.patch
new file mode 100644
index 0000000..a9873a7
--- /dev/null
+++ b/package/mpd/0005-configure.ac-check-if-libatomic-is-needed.patch
@@ -0,0 +1,40 @@
+From 8eaf14a17244aaf000b4d19e4fde4a637576939f Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sun, 7 Feb 2016 21:40:47 +0100
+Subject: [PATCH] configure.ac: check if libatomic is needed
+
+The mpd source code uses the C++11 <atomic> functionality, which
+internally is implemented using the __atomic_*() gcc built-ins. On
+certain architectures, the __atomic_*() built-ins are implemented in
+the libatomic library that comes with the rest of the gcc runtime. Due
+to this, code using <atomic> might need to link against libatomic,
+otherwise one hits build issues such as:
+
+GlobalEvents.cxx:(.text._ZN12GlobalEvents4EmitENS_5EventE+0x14): undefined reference to `__atomic_fetch_or_4'
+
+on an architecture like SPARC.
+
+To solve this, a configure.ac check is added to know if we need to
+link against libatomic or not.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 107b45a..8e6fab7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -233,6 +233,8 @@ if test x$have_pthread_setname_np = xyes; then
+ AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
+ fi
+
++AC_SEARCH_LIBS([__atomic_load_4], [atomic])
++
+ dnl ---------------------------------------------------------------------------
+ dnl Event loop selection
+ dnl ---------------------------------------------------------------------------
+--
+2.6.4
+
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index b368397..3ac806f 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -6,6 +6,7 @@ menuconfig BR2_PACKAGE_MPD
depends on BR2_USE_MMU # libglib2
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC
select BR2_PACKAGE_BOOST
select BR2_PACKAGE_LIBGLIB2
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
@@ -312,5 +313,6 @@ endif
comment "mpd needs a toolchain w/ C++, threads, wchar, gcc >= 4.6"
depends on BR2_USE_MMU
depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
+ depends on BR2_TOOLCHAIN_HAS_ATOMIC
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
!BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
index 7a265f4..d5d77a6 100644
--- a/package/mpd/mpd.mk
+++ b/package/mpd/mpd.mk
@@ -11,6 +11,7 @@ MPD_SITE = http://www.musicpd.org/download/mpd/$(MPD_VERSION_MAJOR)
MPD_DEPENDENCIES = host-pkgconf boost libglib2
MPD_LICENSE = GPLv2+
MPD_LICENSE_FILES = COPYING
+MPD_AUTORECONF = YES
# Some options need an explicit --disable or --enable
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [git commit] mpd: fix build on SPARC
2016-02-07 21:02 [Buildroot] [git commit] mpd: fix build on SPARC Thomas Petazzoni
@ 2016-02-11 11:12 ` Jörg Krause
2016-02-12 20:50 ` Arnout Vandecappelle
0 siblings, 1 reply; 4+ messages in thread
From: Jörg Krause @ 2016-02-11 11:12 UTC (permalink / raw)
To: buildroot
Dear Thomas Petazzoni,
On So, 2016-02-07 at 22:02 +0100, Thomas Petazzoni wrote:
> commit: https://git.buildroot.net/buildroot/commit/?id=84533029c70a4d
> ffb2cd2e4f05e3903fd1b8fcd9
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/mas
> ter
>
> mpd uses __atomic_*() built-ins, but forgets to link with -latomic
> when needed, so this commit adds a patch that ensures it will link
> with libatomic, and adds a dependency on BR2_TOOLCHAIN_HAS_ATOMIC.
>
> Fixes:
>
> ? http://autobuild.buildroot.net/results/e2207280f3a177e12dba502b1c01
> f5aeb431d04c/
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> ?...configure.ac-check-if-libatomic-is-needed.patch | 40
> ++++++++++++++++++++++
> ?package/mpd/Config.in??????????????????????????????|??2 ++
> ?package/mpd/mpd.mk?????????????????????????????????|??1 +
> ?3 files changed, 43 insertions(+)
>
> diff --git a/package/mpd/0005-configure.ac-check-if-libatomic-is-
> needed.patch b/package/mpd/0005-configure.ac-check-if-libatomic-is-
> needed.patch
> new file mode 100644
> index 0000000..a9873a7
> --- /dev/null
> +++ b/package/mpd/0005-configure.ac-check-if-libatomic-is-
> needed.patch
> @@ -0,0 +1,40 @@
> +From 8eaf14a17244aaf000b4d19e4fde4a637576939f Mon Sep 17 00:00:00
> 2001
> +From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> +Date: Sun, 7 Feb 2016 21:40:47 +0100
> +Subject: [PATCH] configure.ac: check if libatomic is needed
> +
> +The mpd source code uses the C++11 <atomic> functionality, which
> +internally is implemented using the __atomic_*() gcc built-ins. On
> +certain architectures, the __atomic_*() built-ins are implemented in
> +the libatomic library that comes with the rest of the gcc runtime.
> Due
> +to this, code using <atomic> might need to link against libatomic,
> +otherwise one hits build issues such as:
> +
> +GlobalEvents.cxx:(.text._ZN12GlobalEvents4EmitENS_5EventE+0x14):
> undefined reference to `__atomic_fetch_or_4'
> +
> +on an architecture like SPARC.
> +
> +To solve this, a configure.ac check is added to know if we need to
> +link against libatomic or not.
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com
> >
> +---
> + configure.ac | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 107b45a..8e6fab7 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -233,6 +233,8 @@ if test x$have_pthread_setname_np = xyes; then
> +? AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is
> pthread_setname_np() available?])
> + fi
> +?
> ++AC_SEARCH_LIBS([__atomic_load_4], [atomic])
> ++
> + dnl -------------------------------------------------------------
> --------------
> + dnl Event loop selection
> + dnl -------------------------------------------------------------
> --------------
> +--?
> +2.6.4
> +
> diff --git a/package/mpd/Config.in b/package/mpd/Config.in
> index b368397..3ac806f 100644
> --- a/package/mpd/Config.in
> +++ b/package/mpd/Config.in
> @@ -6,6 +6,7 @@ menuconfig BR2_PACKAGE_MPD
> ? depends on BR2_USE_MMU # libglib2
> ? depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
> ? depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
> + depends on BR2_TOOLCHAIN_HAS_ATOMIC
> ? select BR2_PACKAGE_BOOST
> ? select BR2_PACKAGE_LIBGLIB2
> ? select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
> @@ -312,5 +313,6 @@ endif
> ?comment "mpd needs a toolchain w/ C++, threads, wchar, gcc >= 4.6"
> ? depends on BR2_USE_MMU
> ? depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
> + depends on BR2_TOOLCHAIN_HAS_ATOMIC
> ? depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
> ? !BR2_TOOLCHAIN_HAS_THREADS ||
> !BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
> diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
> index 7a265f4..d5d77a6 100644
> --- a/package/mpd/mpd.mk
> +++ b/package/mpd/mpd.mk
> @@ -11,6 +11,7 @@ MPD_SITE = http://www.musicpd.org/download/mpd/$(MP
> D_VERSION_MAJOR)
> ?MPD_DEPENDENCIES = host-pkgconf boost libglib2
> ?MPD_LICENSE = GPLv2+
> ?MPD_LICENSE_FILES = COPYING
> +MPD_AUTORECONF = YES
> ?
> ?# Some options need an explicit --disable or --enable
> ?
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
With this commit mpd requires libatomic.so to be installed on the
target:
$ output/host/usr/bin/arm-linux-readelf -d output/target/usr/bin/mpd
| grep libatomic
?0x00000001 (NEEDED)?????????????????????Shared library:
[libatomic.so.1]
Otherwise mpd fails with:
"Error loading shared library libatomic.so.1: No such file or
directory (needed by /usr/bin/mpd)".
However, with an external musl toolchain built with Buildroot no
libatomic.so will be installed on the target, it only exists in
sysroot:
$ find output/ -type f -name "libatomic.so*"
output/host/usr/arm-buildroot-linux-
musleabi/sysroot/lib/libatomic.so.1.1.0
Best regards
J?rg Krause
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [git commit] mpd: fix build on SPARC
2016-02-11 11:12 ` Jörg Krause
@ 2016-02-12 20:50 ` Arnout Vandecappelle
2016-02-12 21:17 ` Thomas Petazzoni
0 siblings, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2016-02-12 20:50 UTC (permalink / raw)
To: buildroot
On 11-02-16 12:12, J?rg Krause wrote:
> Dear Thomas Petazzoni,
>
> On So, 2016-02-07 at 22:02 +0100, Thomas Petazzoni wrote:
>> commit: https://git.buildroot.net/buildroot/commit/?id=84533029c70a4d
>> ffb2cd2e4f05e3903fd1b8fcd9
>> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/mas
>> ter
>>
>> mpd uses __atomic_*() built-ins, but forgets to link with -latomic
>> when needed, so this commit adds a patch that ensures it will link
>> with libatomic, and adds a dependency on BR2_TOOLCHAIN_HAS_ATOMIC.
>>
>> Fixes:
>>
>> http://autobuild.buildroot.net/results/e2207280f3a177e12dba502b1c01
>> f5aeb431d04c/
>>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> ---
>> ...configure.ac-check-if-libatomic-is-needed.patch | 40
>> ++++++++++++++++++++++
>> package/mpd/Config.in | 2 ++
>> package/mpd/mpd.mk | 1 +
>> 3 files changed, 43 insertions(+)
>>
>> diff --git a/package/mpd/0005-configure.ac-check-if-libatomic-is-
>> needed.patch b/package/mpd/0005-configure.ac-check-if-libatomic-is-
>> needed.patch
>> new file mode 100644
>> index 0000000..a9873a7
>> --- /dev/null
>> +++ b/package/mpd/0005-configure.ac-check-if-libatomic-is-
>> needed.patch
>> @@ -0,0 +1,40 @@
>> +From 8eaf14a17244aaf000b4d19e4fde4a637576939f Mon Sep 17 00:00:00
>> 2001
>> +From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>> +Date: Sun, 7 Feb 2016 21:40:47 +0100
>> +Subject: [PATCH] configure.ac: check if libatomic is needed
>> +
>> +The mpd source code uses the C++11 <atomic> functionality, which
>> +internally is implemented using the __atomic_*() gcc built-ins. On
>> +certain architectures, the __atomic_*() built-ins are implemented in
>> +the libatomic library that comes with the rest of the gcc runtime.
>> Due
>> +to this, code using <atomic> might need to link against libatomic,
>> +otherwise one hits build issues such as:
>> +
>> +GlobalEvents.cxx:(.text._ZN12GlobalEvents4EmitENS_5EventE+0x14):
>> undefined reference to `__atomic_fetch_or_4'
>> +
>> +on an architecture like SPARC.
>> +
>> +To solve this, a configure.ac check is added to know if we need to
>> +link against libatomic or not.
>> +
>> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com
>>>
>> +---
>> + configure.ac | 2 ++
>> + 1 file changed, 2 insertions(+)
>> +
>> +diff --git a/configure.ac b/configure.ac
>> +index 107b45a..8e6fab7 100644
>> +--- a/configure.ac
>> ++++ b/configure.ac
>> +@@ -233,6 +233,8 @@ if test x$have_pthread_setname_np = xyes; then
>> + AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is
>> pthread_setname_np() available?])
>> + fi
>> +
>> ++AC_SEARCH_LIBS([__atomic_load_4], [atomic])
>> ++
>> + dnl -------------------------------------------------------------
>> --------------
>> + dnl Event loop selection
>> + dnl -------------------------------------------------------------
>> --------------
>> +--
>> +2.6.4
>> +
>> diff --git a/package/mpd/Config.in b/package/mpd/Config.in
>> index b368397..3ac806f 100644
>> --- a/package/mpd/Config.in
>> +++ b/package/mpd/Config.in
>> @@ -6,6 +6,7 @@ menuconfig BR2_PACKAGE_MPD
>> depends on BR2_USE_MMU # libglib2
>> depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
>> depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
>> + depends on BR2_TOOLCHAIN_HAS_ATOMIC
>> select BR2_PACKAGE_BOOST
>> select BR2_PACKAGE_LIBGLIB2
>> select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
>> @@ -312,5 +313,6 @@ endif
>> comment "mpd needs a toolchain w/ C++, threads, wchar, gcc >= 4.6"
>> depends on BR2_USE_MMU
>> depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
>> + depends on BR2_TOOLCHAIN_HAS_ATOMIC
>> depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
>> !BR2_TOOLCHAIN_HAS_THREADS ||
>> !BR2_TOOLCHAIN_GCC_AT_LEAST_4_6
>> diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
>> index 7a265f4..d5d77a6 100644
>> --- a/package/mpd/mpd.mk
>> +++ b/package/mpd/mpd.mk
>> @@ -11,6 +11,7 @@ MPD_SITE = http://www.musicpd.org/download/mpd/$(MP
>> D_VERSION_MAJOR)
>> MPD_DEPENDENCIES = host-pkgconf boost libglib2
>> MPD_LICENSE = GPLv2+
>> MPD_LICENSE_FILES = COPYING
>> +MPD_AUTORECONF = YES
>>
>> # Some options need an explicit --disable or --enable
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
> With this commit mpd requires libatomic.so to be installed on the
> target:
>
> $ output/host/usr/bin/arm-linux-readelf -d output/target/usr/bin/mpd
> | grep libatomic
> 0x00000001 (NEEDED) Shared library:
> [libatomic.so.1]
>
> Otherwise mpd fails with:
> "Error loading shared library libatomic.so.1: No such file or
> directory (needed by /usr/bin/mpd)".
>
> However, with an external musl toolchain built with Buildroot no
> libatomic.so will be installed on the target, it only exists in
> sysroot:
>
> $ find output/ -type f -name "libatomic.so*"
> output/host/usr/arm-buildroot-linux-
> musleabi/sysroot/lib/libatomic.so.1.1.0
I wonder if we shouldn't just copy all the libraries for the external
toolchains. If you're using an external toolchain, you probably don't care about
size too much. Or you'd use a buildroot-built external toolchain, and in that
case really everything is needed.
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
* [Buildroot] [git commit] mpd: fix build on SPARC
2016-02-12 20:50 ` Arnout Vandecappelle
@ 2016-02-12 21:17 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2016-02-12 21:17 UTC (permalink / raw)
To: buildroot
Arnout,
On Fri, 12 Feb 2016 21:50:24 +0100, Arnout Vandecappelle wrote:
> > However, with an external musl toolchain built with Buildroot no
> > libatomic.so will be installed on the target, it only exists in
> > sysroot:
> >
> > $ find output/ -type f -name "libatomic.so*"
> > output/host/usr/arm-buildroot-linux-
> > musleabi/sysroot/lib/libatomic.so.1.1.0
>
> I wonder if we shouldn't just copy all the libraries for the external
> toolchains. If you're using an external toolchain, you probably don't care about
> size too much. Or you'd use a buildroot-built external toolchain, and in that
> case really everything is needed.
I really don't see why users of external toolchains would not care
about size.
However, libatomic is pretty much as essential as libgcc is, so we
should definitely add it to the libraries that should always be copied.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-12 21:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-07 21:02 [Buildroot] [git commit] mpd: fix build on SPARC Thomas Petazzoni
2016-02-11 11:12 ` Jörg Krause
2016-02-12 20:50 ` Arnout Vandecappelle
2016-02-12 21:17 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox