Hi!
It comes from the "sysroot". I did the following to figure that out:
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 14a1bdc0e5..9a2a5df543 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -821,6 +821,7 @@ rtc_library("webrtc_multiopus") {
rtc_library("webrtc_opus_wrapper") {
poisonous = [ "audio_codecs" ]
+ cflags = ["-E"] #
https://stackoverflow.com/questions/4900870/can-gcc-output-c-code-after-preprocessing sources = [
"codecs/opus/opus_inst.h",
"codecs/opus/opus_interface.cc",
Then
$ gn gen out/Default
$ autoninja -C out/Default webrtc_opus_wrapper
$ less out/Default/obj/modules/audio_coding/webrtc_opus_wrapper/opus_interface.o
I can find the signature for calloc in the preprocessed source:
# 395 "../../build/linux/debian_sid_amd64-sysroot/usr/include/stdlib.h" 2 3 4
<snip>
extern void *calloc (size_t __nmemb, size_t __size)
throw () __attribute__ ((__malloc__)) ;
I find that rather surprising. Like you suggest, I would expect that you would have to include stdlib.h and not get it forced upon you. I tried checking where it comes from with -H to GCC:
. ../../rtc_base/checks.h
.. ../../buildtools/third_party/libc++/trunk/include/string
...... ../../buildtools/third_party/libc++/trunk/include/utility
........ ../../buildtools/third_party/libc++/trunk/include/cstdlib
......... ../../buildtools/third_party/libc++/trunk/include/stdlib.h
.......... ../../build/linux/debian_sid_amd64-sysroot/usr/include/stdlib.h
I think that means rtc_base/checks.h includes <string>, which includes <utility>, which includes <cstdlib>, which includes stdlib.h. Makes sense? I guess you're compiling with a different stdlib than what we are since it's not doing that for you?
/ P