[Bug 242945] devel/cmake: bad interaction with non-default compilers: cmake loses ccache

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Mar 16 22:29:02 GMT 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242945

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

Main contributor appears to be the combination of a cmake port that also sets
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}" == "yes" && !defined(NO_CCACHE)
CMAKE_ARGS+=    -DCMAKE_C_COMPILER_LAUNCHER=${CCACHE_BIN} \
                -DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE_BIN}
.endif

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

3. Try to build the port and observe.

You'll see this in configure:
...
===>   rawtherapee-5.8_1 depends on shared library: libjpeg.so - found
(/usr/local/lib/libjpeg.so)
===>  Configuring for rawtherapee-5.8_1
===>  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=0 -DMYFILE_MMAP -DNDEBUG
-DRT_FFTW3F_OMP -DSTRICT_MUTEX=1 -DTRACE_MYRWMUTEX=0 -D_DNDEBUG -Irtengine
-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 -flto=16
-O3 -funroll-loops -msse2 -fstack-protector-strong
-Wl,-rpath=/usr/local/lib/gcc9  -nostdinc++ -isystem /usr/include/c++/v1
-Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include -std=c++11
-march=native -Werror=unused-label -Werror=delete-incomplete -Wall
-Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result
-fopenmp -Werror=unknown-pragmas -O2 -pipe  -I/usr/local/include -fPIC -flto=16
-O3 -funroll-loops -msse2 -fstack-protector-strong
-Wl,-rpath=/usr/local/lib/gcc9  -nostdinc++ -isystem /usr/include/c++/v1
-Wl,-rpath=/usr/local/lib/gcc9 -isystem /usr/local/include   -ftree-vectorize
-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 compilation
time is more or less the same.

4. Now (a) comment out USE_GCC from Makefile, (b)  change the USES= line from
compiler:gcc-c++11-lib to compiler:c++11-lib, and (c) change _LTO_FLAGS= to
read _LTO_FLAGS=-flto=thin 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.

===>  Configuring for rawtherapee-5.8_1
===>  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=0 -DMYFILE_MMAP
-DNDEBUG -DRT_FFTW3F_OMP -DSTRICT_MUTEX=1 -DTRACE_MYRWMUTEX=0 -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=thin -O3 -funroll-loops -msse2
-fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing 
-isystem /usr/local/include -std=c++11 -march=native -Werror=unused-label
-Werror=delete-incomplete -Wall -Wuninitialized -Wcast-qual
-Wno-deprecated-declarations -Wno-unused-result -fopenmp=libomp
-Werror=unknown-pragmas -O2 -pipe -I/usr/local/include -fPIC -flto=thin -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/panasonicattribs.cc

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

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


More information about the kde-freebsd mailing list