[SERVER-13195] Build fails if --heapcheck is specified Created: 14/Mar/14  Updated: 13/Jul/15  Resolved: 13/Jul/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 2.6.0-rc1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Davide Italiano Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 26qa, build-failure
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13196 Build: --d is not honored when --heap... Closed
Operating System: ALL
Participants:

 Description   

This happens on 2.7.0-pre, githash c6bef666334edc794e71ef9ddbbe4cca35fb4da9

[davide@localhost mongo]$ scons mongod mongo --heapcheck --use-system-tcmalloc --dd

Build output:

[...]
 
g++ -o build/linux2/dd/use-system-tcmalloc/mongo/db/db.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O0 -fstack-protector -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -fno-builtin-memcmp -fno-omit-frame-pointer -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -D_DEBUG -DMONGO_HAVE___THREAD -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DHEAP_CHECKING -Ibuild/linux2/dd/use-system-tcmalloc/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/dd/use-system-tcmalloc/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/linux2/dd/use-system-tcmalloc/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/dd/use-system-tcmalloc/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/dd/use-system-tcmalloc/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/dd/use-system-tcmalloc -Isrc -Ibuild/linux2/dd/use-system-tcmalloc/mongo -Isrc/mongo -Ibuild/linux2/dd/use-system-tcmalloc/third_party/s2 -Isrc/third_party/s2 -Ibuild/linux2/dd/use-system-tcmalloc/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/dd/use-system-tcmalloc/third_party/v8/include -Isrc/third_party/v8/include -Ibuild/linux2/dd/use-system-tcmalloc/third_party/yaml-cpp-0.5.1/include -Isrc/third_party/yaml-cpp-0.5.1/include src/mongo/db/db.cpp
src/mongo/db/db.cpp: In function 'int main(int, char**, char**)':
src/mongo/db/db.cpp:821:45: error: declaration of C function 'int main(int, char**, char**)' conflicts with
 int main(int argc, char* argv[], char** envp) {
                                             ^
In file included from /usr/include/google/heap-checker.h:33:0,
                 from src/mongo/util/heapcheck.h:35,
                 from src/mongo/util/concurrency/mutex.h:29,
                 from src/mongo/bson/optime.h:23,
                 from src/mongo/db/jsobj.h:34,
                 from src/mongo/db/auth/authz_manager_external_state.h:39,
                 from src/mongo/db/auth/authz_manager_external_state_local.h:37,
                 from src/mongo/db/auth/authz_manager_external_state_d.h:37,
                 from src/mongo/db/db.cpp:41:
/usr/include/gperftools/heap-checker.h:243:14: error: previous declaration 'int main(int, char**)' here
   friend int main(int, char**);
              ^
In file included from src/third_party/boost/boost/filesystem/v3/path_traits.hpp:23:0,
                 from src/third_party/boost/boost/filesystem/v3/path.hpp:25,
                 from src/third_party/boost/boost/filesystem/v3/operations.hpp:25,
                 from src/third_party/boost/boost/filesystem/operations.hpp:31,
                 from src/mongo/db/db.cpp:34:
src/third_party/boost/boost/system/error_code.hpp: At global scope:
src/third_party/boost/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
     static const error_category &  posix_category = generic_category();
                                    ^
src/third_party/boost/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable]
     static const error_category &  errno_ecat     = generic_category();
                                    ^
src/third_party/boost/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable]
     static const error_category &  native_ecat    = system_category();
                                    ^
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/dd/use-system-tcmalloc/mongo/db/db.o] Error 1
scons: building terminated because of errors.



 Comments   
Comment by Ernie Hershey [ 13/Jul/15 ]

We took out --heapcheck.

Comment by Davide Italiano [ 27/Mar/14 ]

Unfortunately I don't think it's the case.
From my understanding the problem is that the friend declaration of main() in heap-checker.h does not match the one in src/mongo/db/db.cpp, which uses

int main(int, char**, char**)

(changed by https://github.com/mongodb/mongo/commit/41c4c364d1a04de987a1aabe58b38bc4582a534e), causing the clash.
Apparently the easiest solution would be that of changing the heap-checker.h declaration to match the one used in mongo, but digging more carefully in the code I realized the friend declaration is only used for heap-checker unittest and might go away. Upstream report + patch attached: http://code.google.com/p/gperftools/issues/detail?id=613&sort=-id

Comment by Eric Milkie [ 14/Mar/14 ]

It might work if you downgrade gperf-tools to an earlier version.

Generated at Thu Feb 08 03:30:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.