-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Open
Description
Describe the issue
I ran into the issue shown below when upgrading contrib/googletest in FreeBSD from 1.15.2 to 1.17.0.
--- all_subdir_lib/googletest ---
--- gtest-all.pico ---
In file included from /usr/src/contrib/googletest/googletest/src/gtest-all.cc:49:
/usr/src/contrib/googletest/googletest/src/gtest.cc:266:1: error: no previous extern declaration for non-static variable 'FLAGS_gtest_fail_if_no_test_linked' [-Werror,-Wmissing-variable-declarations]
266 | GTEST_DEFINE_bool_(
|
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2277:19: note: expanded from macro 'GTEST_DEFINE_bool_'
2277 | GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
|
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2242:26: note: expanded from macro 'GTEST_FLAG'
2242 | #define GTEST_FLAG(name) FLAGS_gtest_##name
|
<scratch space>:117:1: note: expanded from here
117 | FLAGS_gtest_fail_if_no_test_linked
|
/usr/src/contrib/googletest/googletest/src/gtest.cc:266:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-port.h:2277:14: note: expanded from macro 'GTEST_DEFINE_bool_'
2277 | GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
Steps to reproduce the problem
An example c++ invocation is included below (there's a lot of other stuff included in there because of how FreeBSD builds things...):
$ make all
===> gtest (all)
c++ -target x86_64-unknown-freebsd16.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -g -gz=zlib -MD -MF.depend.gtest-all.o -MTgtest-all.o -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wdate-time -Wmissing-variable-declarations -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Qunused-arguments -I/usr/include/private -I/usr/src/contrib/googletest/googletest/include -I/usr/src/contrib/googletest/googletest -g -gz=zlib -std=gnu++17 -Wno-deprecated-copy -c /usr/src/contrib/googletest/googletest/src/gtest-all.cc -o gtest-all.o
In file included from /usr/src/contrib/googletest/googletest/src/gtest-all.cc:49:
/usr/src/contrib/googletest/googletest/src/gtest.cc:266:1: error: no previous extern declaration for non-static variable 'FLAGS_gtest_fail_if_no_test_linked' [-Werror,-Wmissing-variable-declarations]
266 | GTEST_DEFINE_bool_(
| ^
/usr/include/private/gtest/internal/gtest-port.h:2309:19: note: expanded from macro 'GTEST_DEFINE_bool_'
2309 | GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
| ^
/usr/include/private/gtest/internal/gtest-port.h:2274:26: note: expanded from macro 'GTEST_FLAG'
2274 | #define GTEST_FLAG(name) FLAGS_gtest_##name
| ^
<scratch space>:35:1: note: expanded from here
35 | FLAGS_gtest_fail_if_no_test_linked
| ^
/usr/src/contrib/googletest/googletest/src/gtest.cc:266:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit
/usr/include/private/gtest/internal/gtest-port.h:2309:14: note: expanded from macro 'GTEST_DEFINE_bool_'
2309 | GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
| ^
1 error generated.
*** Error code 1
Stop.
make[3]: stopped making "all" in /usr/src/lib/googletest/gtest
*** Error code 1
Stop.
make[2]: stopped making "all" in /usr/src/lib/googletest
What version of GoogleTest are you using?
1.17.0
What operating system and version are you using?
FreeBSD fbsd-current-envy.local 16.0-CURRENT FreeBSD 16.0-CURRENT #23 openssl-fixups-mvp2-n281072-06074fb97a9c: Sat Oct 11 16:28:55 PDT 2025 [email protected]:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64
What compiler and version are you using?
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
Target: x86_64-unknown-freebsd16.0
Thread model: posix
InstalledDir: /usr/bin
What build system are you using?
$ bmake -VMAKE_VERSION
20250804
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels