Skip to content

Conversation

@teo-tsirpanis
Copy link
Contributor

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

This PR adds the -DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF introduced in googleapis/google-cloud-cpp#13673, to fix errors in CMake 3.30 about target GTest::gmock_main not being found.

Validated locally. This is not a breaking change; the mock targets were already not installed because they belong in COMPONENT google_cloud_cpp_development.

@Cheney-W Cheney-W self-assigned this Jul 9, 2024
@Cheney-W Cheney-W added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Jul 9, 2024
@teo-tsirpanis
Copy link
Contributor Author

I would add it to the port-bug category; it fixes errors in CMake 3.30.

@autoantwort
Copy link
Contributor

Fixes #39789

KiterLuc pushed a commit to TileDB-Inc/TileDB that referenced this pull request Jul 9, 2024
[SC-50499](https://app.shortcut.com/tiledb-inc/story/50499/ci-s-updating-of-cmake-3-30-broke-building-the-gcs-port)

GitHub Action's recent rollout of CMake 3.30 has broken building the
`google-cloud-cpp` port, because it cannot find the `GTest::gmock_main`
target (which is otherwise unused for the mainstream building scenario).

This PR patches the port to remove the `target_link_libraries` command
that links to GMock. Subsequent versions of the Google Cloud client
library have added an official option to disable building the mock
libraries, and microsoft/vcpkg#39802 has been opened to specify the
option in the upstream port.

---
TYPE: NO_HISTORY
@alichnewsky
Copy link

alichnewsky commented Jul 9, 2024

I encountered the same issue as #39789 x64-linux, I can submit a bug report if you wish.
As reported

 git pull origin pull/39803/head
 git pull --rebase=merges  origin pull/39802/head
  • I still get similar errors for some of the libraries
CMake Error at google/cloud/google_cloud_cpp_common.cmake:294 (target_link_libraries):
  The link interface of target "google_cloud_cpp_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/CMakeLists.txt:53 (include)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_monitoring_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/monitoring/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_trace_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/trace/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_iam_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/iam/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_bigquery_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/bigquery/bigquery_grpc.cmake:19 (google_cloud_cpp_add_gapic_library)
  google/cloud/bigquery/CMakeLists.txt:20 (include)


CMake Error at google/cloud/bigtable/CMakeLists.txt:340 (target_link_libraries):
  The link interface of target "google_cloud_cpp_bigtable_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_iap_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/iap/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_kms_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/kms/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_logging_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/logging/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at google/cloud/pubsub/CMakeLists.txt:394 (target_link_libraries):
  The link interface of target "google_cloud_cpp_pubsub_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



CMake Error at google/cloud/spanner/CMakeLists.txt:374 (target_link_libraries):
  The link interface of target "google_cloud_cpp_spanner_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_speech_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.
Call Stack (most recent call first):
  google/cloud/speech/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_storageinsights_mocks"
  contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/storageinsights/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_storagetransfer_mocks"
  contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/storagetransfer/CMakeLists.txt:29 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_support_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/support/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_tasks_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/tasks/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Error at cmake/GoogleCloudCppLibrary.cmake:350 (target_link_libraries):
  The link interface of target "google_cloud_cpp_translate_mocks" contains:

    GTest::gmock_main

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  google/cloud/translate/CMakeLists.txt:19 (google_cloud_cpp_add_gapic_library)


CMake Warning:
  Manually-specified variables were not used by the project:

    FETCHCONTENT_FULLY_DISCONNECTED
    VCPKG_PLATFORM_TOOLSET
    VCPKG_SET_CHARSET_FLAG
    _VCPKG_ROOT_DIR


CMake Generate step failed.  Build files cannot be regenerated correctly.

the additional targets are due to the fact that I build with a vcpkg like

{
    "dependencies" :[
        "abseil",
        {
            "name" : "google-cloud-cpp",
            "features" : [
                "grpc-common",
                "iam",
                "iap",
                "compute",
                "kms",
                "monitoring",
                "logging",
                "opentelemetry",
                "pubsub",
                "rest-common" ,
                "speech",
                "storage",
                "storageinsights",
                "storagetransfer",
                "support",
                "tasks",
                "trace",
                "translate"
            ]
        }
   ]
}

but it looks like the -DBUILD_TESTING=OFF -DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF flags do not result into GOOGLE_CLOUD_CPP_WITH_MOCKS:BOOL=OFF it to my CMakeCache.txt ....

KiterLuc pushed a commit to TileDB-Inc/TileDB that referenced this pull request Jul 9, 2024
[SC-50499](https://app.shortcut.com/tiledb-inc/story/50499/ci-s-updating-of-cmake-3-30-broke-building-the-gcs-port)

GitHub Action's recent rollout of CMake 3.30 has broken building the
`google-cloud-cpp` port, because it cannot find the `GTest::gmock_main`
target (which is otherwise unused for the mainstream building scenario).

This PR patches the port to remove the `target_link_libraries` command
that links to GMock. Subsequent versions of the Google Cloud client
library have added an official option to disable building the mock
libraries, and microsoft/vcpkg#39802 has been opened to specify the
option in the upstream port.

---
TYPE: NO_HISTORY

(cherry picked from commit 4c76857)
@alichnewsky
Copy link

as previously discussed, using cmake 3.30, to make this PR work, I had to also add an additional two lines patch
in a custom port for google-cloud-cpp

file fix_mocks_cmake_dependent_option_mess.patch content:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1a1dc8..807f6e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -173,7 +173,7 @@ provided mocks to test code involving the Cloud C++ clients may wish to turn
 this flag off.]==]
     ON
     "NOT BUILD_TESTING"
-    ON)
+    $<IF:$<BOOL:${BUILD_TESTING}>:OFF:ON>)
 mark_as_advanced(GOOGLE_CLOUD_CPP_WITH_MOCKS)
 
 # The examples use exception handling to simplify the code. Therefore they
@@ -246,7 +246,7 @@ include(CTest)
 # used in the depends condition of the next option.
 include(EnableCxxExceptions)
 
-if (BUILD_TESTING)
+if (BUILD_TESTING OR GOOGLE_CLOUD_CPP_WITH_MOCKS)
     # Discover and add targets for the GTest::gtest and GTest::gmock libraries.
     include(FindGMockWithTargets)
 endif ()

and then one more line in the portfile.cmake

KiterLuc pushed a commit to TileDB-Inc/TileDB that referenced this pull request Jul 9, 2024
[SC-50499](https://app.shortcut.com/tiledb-inc/story/50499/ci-s-updating-of-cmake-3-30-broke-building-the-gcs-port)

GitHub Action's recent rollout of CMake 3.30 has broken building the
`google-cloud-cpp` port, because it cannot find the `GTest::gmock_main`
target (which is otherwise unused for the mainstream building scenario).

This PR patches the port to remove the `target_link_libraries` command
that links to GMock. Subsequent versions of the Google Cloud client
library have added an official option to disable building the mock
libraries, and microsoft/vcpkg#39802 has been opened to specify the
option in the upstream port.

---
TYPE: NO_HISTORY

(cherry picked from commit 4c76857)
@Cheney-W Cheney-W added category:port-bug The issue is with a library, which is something the port should already support and removed category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist labels Jul 10, 2024
@Cheney-W Cheney-W added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Jul 10, 2024
@JavierMatosD JavierMatosD merged commit 3389f50 into microsoft:master Jul 10, 2024
@teo-tsirpanis teo-tsirpanis deleted the gcp-no-mocks branch July 10, 2024 15:02
cenit pushed a commit to cenit/vcpkg that referenced this pull request Jul 12, 2024
@dbolduc
Copy link
Contributor

dbolduc commented Jul 17, 2024

@teo-tsirpanis + @alichnewsky: Thanks for this fix.

Comment on lines +9 to +10
- ON)
+ $<IF:$<BOOL:${BUILD_TESTING}>:OFF:ON>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me think about this, and upstream the patch if it makes sense...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-bug The issue is with a library, which is something the port should already support info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants