Closed LebedevRI closed 8 months ago
Let me look into that...
Sorry, i have no clue how to do the bazel part.
Sorry, i have no clue how to do the bazel part.
blech ok. do cmake, i'll take bazel.
With
"BENCHMARK_VERSION=\""+native.module_version()+"\"",
we get
ERROR: /home/runner/work/benchmark/benchmark/BUILD.bazel:71:32: name 'native' is not defined
With
"BENCHMARK_VERSION=\""+module_version()+"\"",
(which is the right syntax i guess?) we get
ERROR: Traceback (most recent call last):
File "/home/runner/work/benchmark/benchmark/BUILD.bazel", line 71, column 31, in <toplevel>
"BENCHMARK_VERSION=\""+module_version()+"\"",
Error: unsupported binary operation: string + NoneType
Does that mean there is no version string?
But MODULE.bazel
has
module(
name = "google_benchmark",
version = "1.8.3",
)
With
"BENCHMARK_VERSION=\""+module_version()+"\"",
(which is the right syntax i guess?) we get
ERROR: Traceback (most recent call last): File "/home/runner/work/benchmark/benchmark/BUILD.bazel", line 71, column 31, in <toplevel> "BENCHMARK_VERSION=\""+module_version()+"\"", Error: unsupported binary operation: string + NoneType
Does that mean there is no version string? But
MODULE.bazel
hasmodule( name = "google_benchmark", version = "1.8.3", )
https://bazel.build/rules/lib/toplevel/native#module_version
"If this package is from a repo defined in WORKSPACE instead of MODULE.bazel, this is empty. "
i guess we have both WORKSPACE and MODULE.bazel so it's returning no version?
Right, i guess that makes sense, but it does not really tell me how to fix this. Sorry. :/
Right, i guess that makes sense, but it does not really tell me how to fix this. Sorry. :/
don't be. drop bazel, i'll deal with it. i think i know what we need to do.
just to confirm: with bzlmod enabled, this gets further. two things missing:
/usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF bazel-out/k8-fastbuild/bin/_objs/benchmark/benchmark.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/_objs/benchmark/benchmark.pic.o' -fPIC -DBENCHMARK_STATIC_DEFINE '-DBENCHMARK_VERSION=1.8.3' '-D_FILE_OFFSET_BITS=64' -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -iquote . -iquote bazel-out/k8-fastbuild/bin -Ibazel-out/k8-fastbuild/bin/_virtual_includes/benchmark '-Werror=old-style-cast' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/benchmark.cc -o bazel-out/k8-fastbuild/bin/_objs/benchmark/benchmark.pic.o)
<command-line>: error: too many decimal points in number
src/benchmark.cc:753:11: note: in expansion of macro 'BENCHMARK_VERSION'
753 | return {BENCHMARK_VERSION};
| ^~~~~~~~~~~~~~~~~
src/benchmark.cc: In function 'std::string benchmark::GetBenchmarkVersiom()':
src/benchmark.cc:753:28: error: could not convert '{<expression error>}' from '<brace-enclosed initializer list>' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
753 | return {BENCHMARK_VERSION};
| ^
| |
| <brace-enclosed initializer list>
- figure out why it's failing with:
It needs to be -DBENCHMARK_VERSION="string"
not -DBENCHMARK_VERSION=string
.
@dmah42 thank you!
i just kept adding \ and it works.
"BENCHMARK_VERSION=\\\"" + module_version() + "\\\"",
As discussed in https://github.com/google/benchmark/issues/1741#issuecomment-1906146318