Bug 102573 - fails to build on armel
Summary: fails to build on armel
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 17.2
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-07 06:52 UTC by Timo Aaltonen
Modified: 2017-10-29 21:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Timo Aaltonen 2017-09-07 06:52:07 UTC
forwarded from https://bugs.debian.org/874531

Builds of mesa for armel have been failing lately:

  glsl/.libs/libstandalone.a(libmesautil_la-disk_cache.o): In function `disk_cache_remove':
  ./build/src/util/../../../src/util/disk_cache.c:643: undefined reference to `__atomic_fetch_add_8'
  collect2: error: ld returned 1 exit status
  Makefile:2110: recipe for target 'glsl_compiler' failed
  make[5]: *** [glsl_compiler] Error 1
  make[5]: Leaving directory '/<<PKGBUILDDIR>>/build/src/compiler'

Please link glsl_compiler (and anything else that uses libstandalone)
against -latomic.  If you don't want that dependency on architectures
that don't need it, you can either conditionalize on architecture or
precede -latomic with -Wl,--as-needed (and follow it with
-Wl,--no-as-needed if desired).
Comment 1 Emil Velikov 2017-09-07 15:01:29 UTC
Hmm the code in src/util/u_atomic.c should handle that.

The code is omitted when the GCC_64BIT_ATOMICS_SUPPORTED test [in configure.ac] reports "it works". I don't have a armel setup handy, so if anyone anyone can polish/fix the test and send a patch, that would be appreciated.
Comment 2 Shmerl 2017-09-13 22:46:12 UTC
(In reply to Emil Velikov from comment #1)
> I don't have a armel setup handy, so if
> anyone anyone can polish/fix the test and send a patch, that would be
> appreciated.

It might be possible to set up without hardware, just using Qemu.
Comment 3 Grazvydas Ignotas 2017-09-16 12:32:18 UTC
On what conditions does this show up? Mesa git builds fine on debian stretch and it's gcc 6.3.0, gcc is generating __sync_* calls even when __atomic_* is explicitly used, and that is handled.

(In reply to Shmerl from comment #2)
> It might be possible to set up without hardware, just using Qemu.
It takes ~8h to build mesa configured with just swrast, and qemu can't make use of multiple cores when emulating ARM, so not always a good option.
Comment 4 Shmerl 2017-09-17 02:55:51 UTC
(In reply to Grazvydas Ignotas from comment #3)
> On what conditions does this show up? Mesa git builds fine on debian stretch
> and it's gcc 6.3.0, gcc is generating __sync_* calls even when __atomic_* is
> explicitly used, and that is handled.

It happens in Debian unstable, which uses gcc 7.1.0 already.
Comment 5 Shmerl 2017-09-17 18:32:08 UTC
(In reply to Grazvydas Ignotas from comment #3)
> It takes ~8h to build mesa configured with just swrast, and qemu can't make
> use of multiple cores when emulating ARM, so not always a good option.

Apparently, Qemu should support multithreading for ARM emulation, starting from version 2.9. Unfortunately Debian is still stuck with 2.8 at the moment.

See https://wiki.qemu.org/Features/tcg-multithread
Comment 6 Juan A. Suarez 2017-09-28 14:55:40 UTC
Patches landed in master

https://patchwork.freedesktop.org/series/30551/


Is this fixed?
Comment 7 Andreas Boll 2017-09-28 16:46:13 UTC
(In reply to Juan A. Suarez from comment #6)
> Patches landed in master
> 
> https://patchwork.freedesktop.org/series/30551/
> 
> 
> Is this fixed?

Yeah, it's fixed [1]. Please cherry-pick commit 2ef7f23820a for 17.2.2.

Thanks,
Andreas

[1] https://buildd.debian.org/status/fetch.php?pkg=mesa&arch=armel&ver=17.2.1-2&stamp=1506426795&raw=0


Fixed by:

commit 2ef7f23820a67e958c2252bd81eb0458903ebf33
Author: Grazvydas Ignotas <notasas@gmail.com>
Date:   Mon Sep 18 22:11:26 2017 +0300

    configure: check if -latomic is needed for __atomic_*
    
    On some platforms, gcc generates library calls when __atomic_* functions
    are used, but does not link the required library (libatomic) automatically
    (supposedly to allow the app to use some other atomics implementation?).
    
    Detect this at configure time and add the library when needed. Tested
    on armel (library was added) and on x86_64 (was not, as expected).
    
    Some documentation on this is provided in GCC wiki:
    https://gcc.gnu.org/wiki/Atomic/GCCMM
    
    Fixes: 8915f0c0 "util: use GCC atomic intrinsics with explicit memory model"
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102573
    Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Comment 8 Juan A. Suarez 2017-09-28 16:57:15 UTC
(In reply to Andreas Boll from comment #7)
> Yeah, it's fixed [1]. Please cherry-pick commit 2ef7f23820a for 17.2.2.
> 


Sure. It's on the queue.
Comment 9 Bernd Kuhls 2017-10-29 13:01:57 UTC
Hi,

this patch breaks building mesa3d 17.2.3 with

Target: powerpc-ctng_e500v2-linux-gnuspe
gcc version 4.7.3 (crosstool-NG hg+-c65fcf8a34b7) 

as reported by buildroot autobuilders:

http://autobuild.buildroot.net/?reason=mesa3d-17.2.3

Quoting http://autobuild.buildroot.net/results/43d/43d8bf9a1531f4b69e22bfb53b4536d76cf31cbb/build-end.log

/home/peko/autobuild/instance-0/output/host/opt/ext-toolchain/bin/../lib/gcc/powerpc-ctng_e500v2-linux-gnuspe/4.7.3/../../../../powerpc-ctng_e500v2-linux-gnuspe/bin/ld: cannot find -latomic

Quoting from configure output:

checking whether -latomic is needed... yes
checking whether __sync_add_and_fetch_8 is supported... no
Comment 10 Matt Turner 2017-10-29 21:39:00 UTC
(In reply to Bernd Kuhls from comment #9)

Open a new bug


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.