Is clang defining USE_TCMALLOC by default?

56 views
Skip to first unread message

Simon Que

unread,
Mar 9, 2018, 8:01:13 PM3/9/18
to chromium-os-dev
I'm using clang to build some Chrome OS code outside of the CrOS build environment. Everything is being built from a single Makefile.

I am getting the below compiler error in libchrome/base/allocator/allocator_extension.cc.

It is attempting to #include the tcmalloc header files, which are inside of a "#if defined(USE_TCMALLOC)" block. I would expect that USE_TCMALLOC is not defined by default. Is this not the case?

Simon

========================

clang++ -g -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0  -I . -I atrusctl/src -I atrus-genfiles/include -I libchrome -I libbrillo -I chromim/src -I tcmlloc -I /usr/include/dbus-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -c libchrome/base/allocator/allocator_extension.cc  -o libchrome/base/allocator/allocator_extension.o

libchrome/base/allocator/allocator_extension.cc:10:10: fatal error: 'third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h' file not found

#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"

Mike Frysinger

unread,
Mar 10, 2018, 12:05:03 PM3/10/18
to Simon Que, chromium-os-dev
i don't see any reason why clang itself would be defining USE_TCMALLOC as that is not a namespaced or standard-defined symbol.  so if you were expecting it to not be defined, but it is, you should check your local source code instead.

you can pass the -E and -dD options to clang to see what & where certain CPP macros get defined.
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Simon Que

unread,
Mar 10, 2018, 12:54:26 PM3/10/18
to Mike Frysinger, chromium-os-dev
I see it -- it's in our build_config.h.

The trick was to add -DNO_TCMALLOC to turn it off.

https://cs.chromium.org/chromium/src/build/build_config.h?type=cs&q=USE_TCMALLOC+file:%5Esrc/+package:%5Echromium$&l=92
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages