-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: TESTONLY targets don't appear to get installed #1407
Comments
Thanks for the report. I agree that the |
I took at look at this. It looks like the reason we require explicitly enabling testing to build and install the |
Thanks. I figured that avoiding a googletest dependency was probably the reasoning behind this decision. With a patch, we should be able to fix vcpkg, but it will require the vcpkg build Abseil's tests. Would it be possible to make Abseil automatically build and install the TESTONLY targets when googletest is present? Because in order to use the TESTONLY targets, the user has to have googletest anyway. However, the user still probably doesn't care to build Abseil's tests. |
they are built #1407 PiperOrigin-RevId: 513684529 Change-Id: Ie0a164eea32becfef8f8e4a112aee158fd93dd7e
The We do have a CMake option |
@derekmauro, I used 807763a in conda-forge/abseil-cpp-feedstock#58, and it seems that
|
OK, nevermind, this was an operator error on my part (fun with default variable substitution not working in batch scripts... 😑). Still, it seem the test dll isn't buildable by default:
|
they are built abseil#1407 PiperOrigin-RevId: 513684529 Change-Id: Ie0a164eea32becfef8f8e4a112aee158fd93dd7e
This patch cherry-picks 807763a #1407 --------- Co-authored-by: Derek Mauro <[email protected]>
OK, I got a bit further with the following patch: commit bfac9193f2b18fb585747df39c27ff94d3fce01d
Author: H. Vetinari <[email protected]>
Date: Sun May 7 18:24:46 2023 +1100
add some necessary source files to ABSL_INTERNAL_TEST_DLL_FILES
diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index 1aecd926..26078596 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -584,6 +584,10 @@ set(ABSL_INTERNAL_TEST_DLL_FILES
"hash/hash_testing.h"
"log/scoped_mock_log.cc"
"log/scoped_mock_log.h"
+ "random/internal/chi_square.cc"
+ "random/internal/chi_square.h"
+ "random/internal/distribution_test_util.cc"
+ "random/internal/distribution_test_util.h"
"random/internal/mock_helpers.h"
"random/internal/mock_overload_set.h"
"random/mocking_bit_gen.h" which now fails with
AFAICT, the issue is that
I don't understand |
Found a fix after much banging of heads against walls: commit dd5375ee269b6431c029efd1dae91525cb891492 (HEAD -> conda)
Author: H. Vetinari <[email protected]>
Date: Sun May 7 20:26:19 2023 +1100
update ABSL_CC_TEST_LINKOPTS when using shared build
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index f452a676..89f6ba9a 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -427,6 +427,10 @@ function(absl_cc_test)
DEPS ${ABSL_CC_TEST_DEPS}
OUTPUT ABSL_CC_TEST_DEPS
)
+ absl_internal_dll_targets(
+ DEPS ${ABSL_CC_TEST_LINKOPTS}
+ OUTPUT ABSL_CC_TEST_LINKOPTS
+ )
else()
target_compile_definitions(${_NAME}
PUBLIC That gets me until:
Missing vtables is much more annoying to debug because it could be any member function or data member. I tried to have a look and no missing definition in the header/implementation of that class stood out to me. It seems to point to the constructor, but if I understand member initializer lists correctly, The one thing I'm not sure about is how the constructor definition
seems to simultaneously try to address two declarations ( |
OK, I had managed to lead myself astray here, it was one of those |
This is a heavily modified version of #1445, which adds some missing test libraries to the test DLL. Unlike #1445, this change moves several global variables out of headers that did not need to be in headers. For instance, cord_btree_exhaustive_validation was a global defined/declared in cord_internal, but only used in cord_rep_btree and its test. cordz_handle defined a queue in its header even though it wasn't needed, which also led to ODR problems. The Spinlock used in CordzHandle is replaced with a Mutex. This was originally a Mutex, but Chromium asked us to change it to a Spinlock to avoid a static initializer. After this change, the static initializer is no longer an issue. #1407 PiperOrigin-RevId: 531516991 Change-Id: I0e431a193698b20ba03fac6e414c26f153f330a7
This is a heavily modified version of abseil#1445, which adds some missing test libraries to the test DLL. Unlike abseil#1445, this change moves several global variables out of headers that did not need to be in headers. For instance, cord_btree_exhaustive_validation was a global defined/declared in cord_internal, but only used in cord_rep_btree and its test. cordz_handle defined a queue in its header even though it wasn't needed, which also led to ODR problems. The Spinlock used in CordzHandle is replaced with a Mutex. This was originally a Mutex, but Chromium asked us to change it to a Spinlock to avoid a static initializer. After this change, the static initializer is no longer an issue. abseil#1407 PiperOrigin-RevId: 531516991 Change-Id: I0e431a193698b20ba03fac6e414c26f153f330a7
Describe the issue
I'm trying to build and install Abseil with CMake and use a
PUBLIC
target that's markedTESTONLY
.abseil-cpp/absl/log/CMakeLists.txt
Lines 618 to 620 in c3b5022
After building and installing, I do not see a cmake target named
absl::scoped_mock_log
.Steps to reproduce the problem
I fetch build and install abseil in a temporary location as follows:
Then I look for a
absl::scoped_mock_log
CMake targetYou can grep that file for a target like,
absl::optional
to see that it does exist.What version of Abseil are you using?
$ git show-ref HEAD
d6ea4df refs/remotes/origin/HEAD
What operating system and version are you using?
macOS 13.2.1
What compiler and version are you using?
$ cc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
What build system are you using?
$ cmake --version
cmake version 3.25.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Additional context
From looking at the this file
abseil-cpp/CMake/AbseilHelpers.cmake
Lines 49 to 50 in d6ea4df
I think I'm required to add
ABSL_BUILD_TESTING=ON
andBUILD_TESTING=ON
(the default) in order to getTESTONLY
targets to work.I think this is probably a misfeature. I think every target that is considered a public API point that users may want to use should be built and installed by default, even without explicitly enabling testing.
The text was updated successfully, but these errors were encountered: