Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2020 22:29:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 242945] devel/cmake: bad interaction with non-default compilers: cmake loses ccache
Message-ID:  <bug-242945-7788-Z2kPaFOVeV@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-242945-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-242945-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242945

--- Comment #2 from Matthias Andree <mandree@FreeBSD.org> ---
I have implemented a workaround in graphics/rawtherapee.  IN=20

Main contributor appears to be the combination of a cmake port that also se=
ts
USE_GCC, and a poudriere rig that enables CCACHE.

To reproduce, I propose:

1. in graphics/rawtherapee, remove this block from Makefile:
.if "${WITH_CCACHE_BUILD}" =3D=3D "yes" && !defined(NO_CCACHE)
CMAKE_ARGS+=3D    -DCMAKE_C_COMPILER_LAUNCHER=3D${CCACHE_BIN} \
                -DCMAKE_CXX_COMPILER_LAUNCHER=3D${CCACHE_BIN}
.endif

2a. install and=20
2b. configure poudriere. Here, in ${PREFIX}/etc/poudriere.conf, enable
CCACHE_DIR (for instance, CCACHE_DIR=3D/usr/obj/ccache)

3. Try to build the port and observe.

You'll see this in configure:
...
=3D=3D=3D>   rawtherapee-5.8_1 depends on shared library: libjpeg.so - found
(/usr/local/lib/libjpeg.so)
=3D=3D=3D>  Configuring for rawtherapee-5.8_1
=3D=3D=3D>  Performing out-of-source build
/bin/mkdir -p /usr/ports.svn/graphics/rawtherapee/work/.build
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /usr/local/bin/gcc9
-- Check for working C compiler: /usr/local/bin/gcc9 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/g++9
-- Check for working CXX compiler: /usr/local/bin/g++9 -- works
-- Detecting CXX compiler ABI info
...
[2/257] /usr/local/bin/g++9  -DAUTO_GDK_FLUSH=3D0 -DMYFILE_MMAP -DNDEBUG
-DRT_FFTW3F_OMP -DSTRICT_MUTEX=3D1 -DTRACE_MYRWMUTEX=3D0 -D_DNDEBUG -Irteng=
ine
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include
-I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include
-I/usr/local/include/gtkmm-3.0 -I/usr/local/lib/gtkmm-3.0/include
-I/usr/local/include/atkmm-1.6 -I/usr/local/include/atk-1.0
-I/usr/local/include/giomm-2.4 -I/usr/local/lib/giomm-2.4/include
-I/usr/local/include/pangomm-1.4 -I/usr/local/lib/pangomm-1.4/include
-I/usr/local/include/cairomm-1.0 -I/usr/local/lib/cairomm-1.0/include
-I/usr/local/include/cairo -I/usr/local/include/pixman-1
-I/usr/local/include/freetype2 -I/usr/local/include/libdrm
-I/usr/local/include/libpng16 -I/usr/local/include/pango-1.0
-I/usr/local/include/fribidi -I/usr/local/include/harfbuzz
-I/usr/local/include/gtk-3.0 -I/usr/local/include/gdk-pixbuf-2.0
-I/usr/local/include/gio-unix-2.0 -I/usr/local/include/libepoll-shim
-I/usr/local/lib/libffi-3.2.1/include -I/usr/local/include/at-spi2-atk/2.0
-I/usr/local/include/at-spi-2.0 -I/usr/local/include/dbus-1.0
-I/usr/local/lib/dbus-1.0/include -I/usr/local/include/gtk-3.0/unix-print
-I/usr/local/include/gdkmm-3.0 -I/usr/local/lib/gdkmm-3.0/include
-I/usr/local/include/libiptcdata -I/usr/local/include/lensfun
-I/usr/local/include/librsvg-2.0 -O2 -pipe  -I/usr/local/include -fPIC -flt=
o=3D16
-O3 -funroll-loops -msse2 -fstack-protector-strong
-Wl,-rpath=3D/usr/local/lib/gcc9  -nostdinc++ -isystem /usr/include/c++/v1
-Wl,-rpath=3D/usr/local/lib/gcc9 -isystem /usr/local/include -std=3Dc++11
-march=3Dnative -Werror=3Dunused-label -Werror=3Ddelete-incomplete -Wall
-Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result
-fopenmp -Werror=3Dunknown-pragmas -O2 -pipe  -I/usr/local/include -fPIC -f=
lto=3D16
-O3 -funroll-loops -msse2 -fstack-protector-strong
-Wl,-rpath=3D/usr/local/lib/gcc9  -nostdinc++ -isystem /usr/include/c++/v1
-Wl,-rpath=3D/usr/local/lib/gcc9 -isystem /usr/local/include   -ftree-vecto=
rize
-MD -MT rtengine/CMakeFiles/rtengine.dir/fast_demo.cc.o -MF
rtengine/CMakeFiles/rtengine.dir/fast_demo.cc.o.d -o
rtengine/CMakeFiles/rtengine.dir/fast_demo.cc.o -c
/usr/ports.svn/graphics/rawtherapee/work/rawtherapee-5.8/rtengine/fast_demo=
.cc

NOTE that the cmake configure phase obtains GCC's absolute path.

NOTE the compilation time, retry, and compile again to see that the compila=
tion
time is more or less the same.

4. Now (a) comment out USE_GCC from Makefile, (b)  change the USES=3D line =
from
compiler:gcc-c++11-lib to compiler:c++11-lib, and (c) change _LTO_FLAGS=3D =
to
read _LTO_FLAGS=3D-flto=3Dthin if your cc is clang.
(Note that you won't obtain a fully working rawtherapee executable that way=
.),
and make clean ; make |& less

You'll see this instead. Observe it has picked c++ from the path, invoking
ccache.

=3D=3D=3D>  Configuring for rawtherapee-5.8_1
=3D=3D=3D>  Performing out-of-source build
/bin/mkdir -p /usr/ports.svn/graphics/rawtherapee/work/.build
-- The C compiler identification is Clang 8.0.1
-- The CXX compiler identification is Clang 8.0.1
-- Check for working C compiler: /usr/local/libexec/ccache/cc
...
[2/284] /usr/local/libexec/ccache/c++  -DAUTO_GDK_FLUSH=3D0 -DMYFILE_MMAP
-DNDEBUG -DRT_FFTW3F_OMP -DSTRICT_MUTEX=3D1 -DTRACE_MYRWMUTEX=3D0 -D_DNDEBUG
-Irtexif -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include
-I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include
-I/usr/local/include/gtk-3.0 -I/usr/local/include/pango-1.0
-I/usr/local/include/fribidi -I/usr/local/include/cairo
-I/usr/local/include/pixman-1 -I/usr/local/include/freetype2
-I/usr/local/include/libdrm -I/usr/local/include/libpng16
-I/usr/local/include/harfbuzz -I/usr/local/include/gdk-pixbuf-2.0
-I/usr/local/include/gio-unix-2.0 -I/usr/local/include/libepoll-shim
-I/usr/local/lib/libffi-3.2.1/include -I/usr/local/include/atk-1.0
-I/usr/local/include/at-spi2-atk/2.0 -I/usr/local/include/at-spi-2.0
-I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include
-I/usr/local/include/gtkmm-3.0 -I/usr/local/lib/gtkmm-3.0/include
-I/usr/local/include/atkmm-1.6 -I/usr/local/include/giomm-2.4
-I/usr/local/lib/giomm-2.4/include -I/usr/local/include/pangomm-1.4
-I/usr/local/lib/pangomm-1.4/include -I/usr/local/include/cairomm-1.0
-I/usr/local/lib/cairomm-1.0/include -I/usr/local/include/gtk-3.0/unix-print
-I/usr/local/include/gdkmm-3.0 -I/usr/local/lib/gdkmm-3.0/include -O2 -pipe
-I/usr/local/include -fPIC -flto=3Dthin -O3 -funroll-loops -msse2
-fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing=20
-isystem /usr/local/include -std=3Dc++11 -march=3Dnative -Werror=3Dunused-l=
abel
-Werror=3Ddelete-incomplete -Wall -Wuninitialized -Wcast-qual
-Wno-deprecated-declarations -Wno-unused-result -fopenmp=3Dlibomp
-Werror=3Dunknown-pragmas -O2 -pipe -I/usr/local/include -fPIC -flto=3Dthin=
 -O3
-funroll-loops -msse2 -fstack-protector-strong -isystem /usr/local/include
-fno-strict-aliasing  -isystem /usr/local/include    -fPIC -MD -MT
rtexif/CMakeFiles/rtexif.dir/panasonicattribs.cc.o -MF
rtexif/CMakeFiles/rtexif.dir/panasonicattribs.cc.o.d -o
rtexif/CMakeFiles/rtexif.dir/panasonicattribs.cc.o -c
/usr/ports.svn/graphics/rawtherapee/work/rawtherapee-5.8/rtexif/panasonicat=
tribs.cc

Observe you'll get /usr/local/libexec/ccache/c++. Let it build, then make c=
lean
and re-build and see that the second build goes much faster.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242945-7788-Z2kPaFOVeV>