[Mesa-dev] [PATCH] disk cache: Link with -latomic if necessary

Eric Engestrom eric.engestrom at imgtec.com
Mon Mar 5 10:18:25 UTC 2018


On Sunday, 2018-03-04 00:20:16 +0000, Mike Lothian wrote:
> Hi
> 
> Sorry to be a pain again
> 
> I've just tested this with clang and the 32bit build still fails without
> -latomic

This fix was for meson, and you're using make here; does it work if you
build using meson? First thing is to figure out if it's an issue with
your setup or the build system.

> 
> libtool: link: /bin/true glsl/.libs/libstandalone.a
> libtool: link: rm -fr glsl/.libs/libstandalone.lax
> glsl/.libs/libstandalone.lax
> libtool: link: ( cd "glsl/.libs" && rm -f "libstandalone.la" && ln -s "../
> libstandalone.la" "libstandalone.la" )
> /bin/sh ../../libtool  --tag=CXX   --mode=link clang++ -m32
> -fvisibility=hidden -Werror=pointer-arith -Werror=vla -O3 -march=native
> -pipe -flto=thin -Wall -fno-math-errno -fno-trapping-math
> -Qunused-arguments   -O3 -march=native -pipe -flto=thin -o glsl_
> compiler glsl/main.o glsl/libstandalone.la
> libtool: link: clang++ -m32 -fvisibility=hidden -Werror=pointer-arith
> -Werror=vla -O3 -march=native -pipe -flto=thin -Wall -fno-math-errno
> -fno-trapping-math -Qunused-arguments -O3 -march=native -pipe -flto=thin -o
> glsl_compiler glsl/main.o  glsl/.libs/l
> ibstandalone.a -lz -lpthread -pthread
> /var/tmp/portage/media-libs/mesa-9999/temp/lto-llvm-4efaa5.o:disk_cache.c:function
> disk_cache_remove: error: undefined reference to '__atomic_fetch_add_8'
> clang-7.0: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[4]: *** [Makefile:2364: glsl_compiler] Error 1
> make[4]: Leaving directory
> '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86/src/compiler'
> 
> make[3]: *** [Makefile:1793: all] Error 2
> make[3]: Leaving directory
> '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86/src/compiler'
> 
> make[2]: *** [Makefile:875: all-recursive] Error 1
> make[2]: Leaving directory
> '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86/src'
> make[1]: *** [Makefile:660: all] Error 2
> make[1]: Leaving directory
> '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86/src'
> make: *** [Makefile:668: all-recursive] Error 1
> * ERROR: media-libs/mesa-9999::gentoo failed (compile phase):
> *   emake failed
> *
> * If you need support, post the output of `emerge --info
> '=media-libs/mesa-9999::gentoo'`,
> * the complete build log and the output of `emerge -pqv
> '=media-libs/mesa-9999::gentoo'`.
> * The complete build log is located at
> '/var/tmp/portage/media-libs/mesa-9999/temp/build.log'.
> * The ebuild environment file is located at
> '/var/tmp/portage/media-libs/mesa-9999/temp/environment'.
> * Working directory:
> '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86'
> * S: '/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999'
> 
> If I pass -latomic in with the LDFLAGS it builds fine
> 
> On Tue, 27 Feb 2018 at 20:22 Matt Turner <mattst88 at gmail.com> wrote:
> 
> > On Tue, Feb 27, 2018 at 2:26 AM, Thierry Reding
> > <thierry.reding at gmail.com> wrote:
> > > On Mon, Feb 26, 2018 at 11:14:05AM -0800, Matt Turner wrote:
> > >> On Fri, Feb 23, 2018 at 5:18 AM, Thierry Reding
> > >> <thierry.reding at gmail.com> wrote:
> > >> > From: Thierry Reding <treding at nvidia.com>
> > >> >
> > >> > The disk cache implementation uses 64-bit atomic operations. For some
> > >> > architectures, such as 32-bit ARM, GCC will not be able to translate
> > >> > these operations into lock-free instructions and will instead rely on
> > >>
> > >> Here, and in the comment in meson.build, I think you mean "atomic"
> > >> rather than "lock-free" instructions? It's at least confusing, since
> > >> on x86 atomic instructions have a "lock" prefix.
> > >
> > > This uses the terminology used by the GCC documentation, see:
> > >
> > >         https://gcc.gnu.org/wiki/Atomic/GCCMM
> > >
> > > I think the GCC terms merely mean that you don't need any explicit
> > > locking for these operations to be atomic.
> > >
> > > How about this instead:
> > >
> > >         "... operations into atomic, lock-free instructions..."
> > >
> > > ?
> >
> > Ah, I see. Thanks, that works for me.
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list