Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699258 - net-irc/znc-9999 fails to compile tests with distcc
Summary: net-irc/znc-9999 fails to compile tests with distcc
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Louis Sautier (sbraz)
Depends on:
Reported: 2019-11-03 21:14 UTC by Alexey
Modified: 2019-11-06 09:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

build.log (build.log,403.74 KB, text/x-log)
2019-11-03 21:14 UTC, Alexey
envcompile (envcompile,14.23 KB, text/plain)
2019-11-03 21:15 UTC, Alexey
envtest1 - very start of src_test() (envtest1,14.24 KB, text/plain)
2019-11-03 21:16 UTC, Alexey
envtest - just before inttest (envtest,14.25 KB, text/plain)
2019-11-03 21:17 UTC, Alexey
emerge --info (emerge-info,15.06 KB, text/plain)
2019-11-03 21:20 UTC, Alexey

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey 2019-11-03 21:14:05 UTC
Created attachment 594968 [details]

In the Compile phase, it uses /usr/lib/distcc/bin/armv7a-unknown-linux-gnueabihf-g++ correctly.
In the Test phase, it starts using /usr/lib/distcc/bin/c++ instead, and the result is being miscompiled for a wrong architecture.

    [1/2] Building CXX object CMakeFiles/cmTC_2d9e8.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_2d9e8
    FAILED: cmTC_2d9e8 
    : && /usr/lib/distcc/bin/c++    -Wl,-O1 -Wl,--as-needed   -rdynamic CMakeFiles/cmTC_2d9e8.dir/testCXXCompiler.cxx.o  -o cmTC_2d9e8   && :
    CMakeFiles/cmTC_2d9e8.dir/testCXXCompiler.cxx.o: file not recognized: file format not recognized
    collect2: error: ld returned 1 exit status
    distcc[204] ERROR: compile (null) on localhost failed

Additionally, unit test is compiled correctly, but integration test is not.

I was advised to add "env > $T/envcompile" statements to src_compile() and src_test() to debug this better, so attaching those as well.
Comment 1 Alexey 2019-11-03 21:15:17 UTC
Created attachment 594970 [details]
Comment 2 Alexey 2019-11-03 21:16:07 UTC
Created attachment 594972 [details]
envtest1 - very start of src_test()
Comment 3 Alexey 2019-11-03 21:17:02 UTC
Created attachment 594974 [details]
envtest - just before inttest
Comment 4 Alexey 2019-11-03 21:20:34 UTC
Created attachment 594976 [details]
emerge --info
Comment 5 James Le Cuirot gentoo-dev 2019-11-04 20:48:15 UTC
It's because the CMake files have CMake reinvoke itself without the usual args we add in the eclass. See the bottom of test/CMakeLists.txt. This might be tricky to fix.
Comment 6 Alexey 2019-11-04 20:51:20 UTC
Looks like this patch fixes it. Is there any other arg I need to pass?

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index cffe3818..87197c2c 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -77,9 +77,7 @@ externalproject_add(inttest_bin
-	# Note the space in the end: protect from CXXFLAGS env var, but
-	# still support custom flags
Comment 7 James Le Cuirot gentoo-dev 2019-11-04 20:55:24 UTC
I guess that alone is enough to fix it but reinvoking CMake like that isn't ideal and could cause other issues. Given this is just for src_test, this is probably sufficient though. I'll like sbraz decide what to do.
Comment 8 Alexey 2019-11-04 20:59:09 UTC
This worked before; is it possible that CXX env variable was set by src_test, but now it's not? Such variable would cause the inner CMake to select correct compiler.
Comment 9 Alexey 2019-11-04 23:00:04 UTC
How do other projects deal with externalproject_add() command?
Comment 10 James Le Cuirot gentoo-dev 2019-11-04 23:07:06 UTC
Sorry, Alexey, I didn't realise you were upstream. You will definitely know CMake better than I do so I can't provide a better answer.
Comment 11 Alexey 2019-11-05 21:08:25 UTC
I've submitted which seems to handle several cases I can think of.

I don't know whether it's worth it to add the patch for 1.7.4 and 1.7.5 to portage tree.

Thanks for help!
Comment 12 Louis Sautier (sbraz) gentoo-dev 2019-11-06 09:43:21 UTC
I'd say such test failures aren't huge problems, I'd rather wait for 1.7.6.