Project

General

Profile

Bug #3198

Fails to build on FreeBSD with Clang since f7940fa01e8b6ef0703236b53721cca2d81b40d3 Use gmock and gtest targets from googletest-release-1.8.0

Added by Vedran Miletic about 1 month ago. Updated 30 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
testing
Target version:
-
Affected version - extra info:
regression, works fine in 2019
Affected version:
Difficulty:
uncategorized
Close

Description

Fails to build with:

% ninja check                                                                                                                                                                               
[2/390] Building CXX object src/external/googletest/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o             
FAILED: src/external/googletest/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o                                                                                                                                                     
/usr/local/bin/ccache  c++  -DGMX_DOUBLE=0 -DGTEST_CAN_STREAM_RESULTS=0 -DGTEST_CREATE_SHARED_LIBRARY=1 -D_GNU_SOURCE=1 -Dgmock_EXPORTS -Isrc -I../src -I../src/external/googletest/googlemock/include -I../src/external/googletest/goo
glemock -I../src/external/googletest/googletest -isystem /usr/local/include -isystem ../src/external/googletest/googletest/include -O3 -DNDEBUG -fPIC     -DGTEST_HAS_PTHREAD=1   -std=c++14 -MD -MT src/external/googletest/googlemock
/CMakeFiles/gmock.dir/src/gmock-all.cc.o -MF src/external/googletest/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o.d -o src/external/googletest/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o -c ../src/external/googletest/g
ooglemock/src/gmock-all.cc                                                                                                                                                                                                             
In file included from ../src/external/googletest/googlemock/src/gmock-all.cc:40:                                   
In file included from ../src/external/googletest/googlemock/include/gmock/gmock.h:58:                                                                                                                                                  
In file included from ../src/external/googletest/googlemock/include/gmock/gmock-actions.h:46:                                                                                                                                          
In file included from ../src/external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:47:                                                                                                                          
In file included from /usr/local/include/gtest/gtest.h:62:                                                                                                                                                                             
/usr/local/include/gtest/internal/gtest-internal.h:110:7: error: redefinition of 'IgnoredValue'                                                                                                                                        
class IgnoredValue {                                                                                                                                                                                                                   
      ^                                                                                                                                                                                                                                
../src/external/googletest/googlemock/include/gmock/internal/gmock-generated-internal-utils.h:55:7: note: previous definition is here                                                                                                  
class IgnoredValue {                                                                                                                                                                                                                   
      ^                                                                                                                                                                                                                                
In file included from ../src/external/googletest/googlemock/src/gmock-all.cc:40:                                                                                                                                                       
In file included from ../src/external/googletest/googlemock/include/gmock/gmock.h:58:                                                                                                                                                  
In file included from ../src/external/googletest/googlemock/include/gmock/gmock-actions.h:46:                                                                                                                                          
../src/external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:56:12: error: unknown type name 'string'; did you mean 'String'?                                                                                   
GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name);                                                                                                                                                                   
           ^~~~~~                                                                                                                                                                                                                      
           String                                                                                                                                                                                                                      
/usr/local/include/gtest/internal/gtest-string.h:58:18: note: 'String' declared here                                                                                                                                                   
class GTEST_API_ String {                                                                                                                                                                                                              
                 ^                                                                                                                                                                                                                     
In file included from ../src/external/googletest/googlemock/src/gmock-all.cc:40:                                                                                                                                                       
In file included from ../src/external/googletest/googlemock/include/gmock/gmock.h:58:                                                                                                                                                  
In file included from ../src/external/googletest/googlemock/include/gmock/gmock-actions.h:46:                                                                                                                                          
../src/external/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:185:51: error: unknown class name 'false_type'; did you mean 'std::false_type'?

History

#1 Updated by Vedran Miletic about 1 month ago

It would also be nice to have something like GMX_EXTERNAL_GTEST for situations like this one.

#2 Updated by Eric Irrgang about 1 month ago

Vedran Miletic wrote:

It would also be nice to have something like GMX_EXTERNAL_GTEST for situations like this one.

Can you tell whether it is a problem with googletest 1.8.0 versus the GROMACS bundling of it? If so, does it go away with googletest 1.8.1?

In addition to allowing an option to use a local googletest package with find_package, we could use the CMake ExternalProject feature to make a nice well-contained googletest build. This may have an added benefit of avoiding the need for as many manipulations of compiler flags, since the success or failure of the ExternalProject build is arbitrarily terse in the CMake output of the parent project.

However, none of these alternatives address the need for GROMACS-sourced patches, if there are GROMACS-supported environments that don't build easily with a tagged googletest release. We could try to separate the googletest source from patches we apply (if necessary), which would also make it easier to update the bundled googletest version, which is currently a very manual process.

#3 Updated by Vedran Miletic about 1 month ago

Eric Irrgang wrote:

Vedran Miletic wrote:

It would also be nice to have something like GMX_EXTERNAL_GTEST for situations like this one.

Can you tell whether it is a problem with googletest 1.8.0 versus the GROMACS bundling of it? If so, does it go away with googletest 1.8.1?

In addition to allowing an option to use a local googletest package with find_package, we could use the CMake ExternalProject feature to make a nice well-contained googletest build. This may have an added benefit of avoiding the need for as many manipulations of compiler flags, since the success or failure of the ExternalProject build is arbitrarily terse in the CMake output of the parent project.

However, none of these alternatives address the need for GROMACS-sourced patches, if there are GROMACS-supported environments that don't build easily with a tagged googletest release. We could try to separate the googletest source from patches we apply (if necessary), which would also make it easier to update the bundled googletest version, which is currently a very manual process.

I'm not sure whether it's googletest or GROMACS bundling, but I can compile standalone googletest 1.8.1 with its tests and samples. Also, dropping googletest 1.8.1 in src/external/googletest does not change anything, but dropping 1.10.0 in place makes the issue go away.

#4 Updated by Eric Irrgang 30 days ago

Vedran Miletic wrote:

Eric Irrgang wrote:

Vedran Miletic wrote:

It would also be nice to have something like GMX_EXTERNAL_GTEST for situations like this one.

Can you tell whether it is a problem with googletest 1.8.0 versus the GROMACS bundling of it? If so, does it go away with googletest 1.8.1?

In addition to allowing an option to use a local googletest package with find_package, we could use the CMake ExternalProject feature to make a nice well-contained googletest build. This may have an added benefit of avoiding the need for as many manipulations of compiler flags, since the success or failure of the ExternalProject build is arbitrarily terse in the CMake output of the parent project.

However, none of these alternatives address the need for GROMACS-sourced patches, if there are GROMACS-supported environments that don't build easily with a tagged googletest release. We could try to separate the googletest source from patches we apply (if necessary), which would also make it easier to update the bundled googletest version, which is currently a very manual process.

I'm not sure whether it's googletest or GROMACS bundling, but I can compile standalone googletest 1.8.1 with its tests and samples. Also, dropping googletest 1.8.1 in src/external/googletest does not change anything, but dropping 1.10.0 in place makes the issue go away.

Can you confirm that standalone 1.8.0 googletest works for you, just for completeness?

The last time I tried to update GROMACS to googletest 1.8.1, it worked for me on several test platforms locally, but had problems on other platforms covered by Jenkins. I suppose it is worth trying again with both 1.8.1 and 1.10.0, but it sounds like the problem you are seeing is related to the way the package is somewhat dissected in the GROMACS context. I'm definitely inclined to try to move to a more compartmentalized and less customized bundling, but that could open a can of worms best postponed to the next development cycle.

Maybe it is best to resolve the current errors by trying to find reasonable updates to the include paths and/or symbol namespaces at this stage of the release cycle.

There are also some modifications to 1.8.0 as bundled that were presumably made to reduce clutter or size, but which aren't supposed to affect functionality. In other words, it is worth checking whether restoring those missing parts solves the problem and, if so, making the bundled 1.8.0 more plain-vanilla. But if you tried just replacing the bundled googletest with 1.8.1, then you may have already ruled out that possibility. In that case, though, I don't see how referencing an external googletest package would help, but I suppose it is worth a try.

Also available in: Atom PDF