Skip to content

[google-cloud-cpp] Add iam_v3 to CMake Config Fixup List#51486

Merged
BillyONeal merged 5 commits into
microsoft:masterfrom
heksterb:google-cloud-cpp-iamv3
May 5, 2026
Merged

[google-cloud-cpp] Add iam_v3 to CMake Config Fixup List#51486
BillyONeal merged 5 commits into
microsoft:masterfrom
heksterb:google-cloud-cpp-iamv3

Conversation

@heksterb
Copy link
Copy Markdown
Contributor

@heksterb heksterb commented May 1, 2026

This fixes the broken iam feature of the google-cloud-cpp port. The symptom (reproduced on arm64-linux and x64-windows):

1> [CMake] CMake Error at C:/Program Files/Microsoft Visual Studio/18/Insiders/VC/vcpkg/scripts/buildsystems/vcpkg.cmake:908 (_find_package):
1> [CMake]   By not providing "Findgoogle_cloud_cpp_iam_v3.cmake" in CMAKE_MODULE_PATH
1> [CMake]   this project has asked CMake to find a package configuration file provided
1> [CMake]   by "google_cloud_cpp_iam_v3", but CMake did not find one.
1> [CMake] 
1> [CMake]   Could not find a package configuration file provided by
1> [CMake]   "google_cloud_cpp_iam_v3" with any of the following names:
1> [CMake] 
1> [CMake]     google_cloud_cpp_iam_v3Config.cmake
1> [CMake]     google_cloud_cpp_iam_v3-config.cmake
1> [CMake] 
1> [CMake]   Add the installation prefix of "google_cloud_cpp_iam_v3" to
1> [CMake]   CMAKE_PREFIX_PATH or set "google_cloud_cpp_iam_v3_DIR" to a directory
1> [CMake]   containing one of the above files.  If "google_cloud_cpp_iam_v3" provides a
1> [CMake]   separate development package or SDK, be sure it has been installed.

Root cause is the addition of the IAM v3 API in this commit of the package source. This causes the creation by this code of

find_dependency(google_cloud_cpp_iam_v3)

in generated google_cloud_cpp_iam-config.cmake. The portfile's google_cloud_cpp_cmake_config_fixup function is responsible for moving CMake config files from lib/cmake/google_cloud_cpp_iam/ to share/google_cloud_cpp_iam/. However, since iam_v3 is missing from the hardcoded list, and as a result the google_cloud_cpp_iam_v3 config files are deleted by the subsequent file(REMOVE_RECURSE).

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download. (N/A)
  • The "supports" clause reflects platforms that may be fixed by this new version, or no changes were necessary.
  • Any fixed CI baseline and CI feature baseline entries are removed from that file, or no entries needed to be changed. (N/A)
  • All patch files in the port are applied and succeed. (N/A)
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Exactly one version is added in each modified versions file.

@heksterb
Copy link
Copy Markdown
Contributor Author

heksterb commented May 1, 2026

@microsoft-github-policy-service agree

@heksterb
Copy link
Copy Markdown
Contributor Author

heksterb commented May 1, 2026

With this patch; on x64-windows (Visual Studio 2026):

1> [CMake]   find_package(google_cloud_cpp_iam CONFIG REQUIRED)
1> [CMake]   target_link_libraries(main PRIVATE google-cloud-cpp::iam google-cloud-cpp::iam_protos)
1> [CMake] 
1> [CMake]   find_package(google_cloud_cpp_iam_v2 CONFIG REQUIRED)
1> [CMake]   target_link_libraries(main PRIVATE google-cloud-cpp::iam_v2_protos)
1> [CMake] 
1> [CMake]   find_package(google_cloud_cpp_iam_v3 CONFIG REQUIRED)
1> [CMake]   target_link_libraries(main PRIVATE google-cloud-cpp::iam_v3_protos)

and on arm64-linux:

  find_package(google_cloud_cpp_iam CONFIG REQUIRED)
  target_link_libraries(main PRIVATE google-cloud-cpp::iam google-cloud-cpp::iam_protos)

  find_package(google_cloud_cpp_iam_v2 CONFIG REQUIRED)
  target_link_libraries(main PRIVATE google-cloud-cpp::iam_v2_protos)

  find_package(google_cloud_cpp_iam_v3 CONFIG REQUIRED)
  target_link_libraries(main PRIVATE google-cloud-cpp::iam_v3_protos)

@BillyONeal
Copy link
Copy Markdown
Member

FAILED: [code=1] google/cloud/accesscontextmanager/CMakeFiles/google_cloud_cpp_accesscontextmanager_protos.dir/google/identity/accesscontextmanager/type/device_resources.pb.cc.o 
/android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=x86_64-none-linux-android28 --sysroot=/android-ndk-r29/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -isystem /mnt/vcpkg-ci/b/google-cloud-cpp/x64-android-dbg/google/cloud/accesscontextmanager -isystem /mnt/vcpkg-ci/installed/x64-android/include -isystem /mnt/vcpkg-ci/b/google-cloud-cpp/x64-android-dbg/external/googleapis -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions  -fPIC   -fno-limit-debug-info    -fPIC -pthread -MD -MT google/cloud/accesscontextmanager/CMakeFiles/google_cloud_cpp_accesscontextmanager_protos.dir/google/identity/accesscontextmanager/type/device_resources.pb.cc.o -MF google/cloud/accesscontextmanager/CMakeFiles/google_cloud_cpp_accesscontextmanager_protos.dir/google/identity/accesscontextmanager/type/device_resources.pb.cc.o.d -o google/cloud/accesscontextmanager/CMakeFiles/google_cloud_cpp_accesscontextmanager_protos.dir/google/identity/accesscontextmanager/type/device_resources.pb.cc.o -c /mnt/vcpkg-ci/b/google-cloud-cpp/x64-android-dbg/google/cloud/accesscontextmanager/google/identity/accesscontextmanager/type/device_resources.pb.cc
In file included from /mnt/vcpkg-ci/b/google-cloud-cpp/x64-android-dbg/google/cloud/accesscontextmanager/google/identity/accesscontextmanager/type/device_resources.pb.cc:6:
/mnt/vcpkg-ci/b/google-cloud-cpp/x64-android-dbg/google/cloud/accesscontextmanager/google/identity/accesscontextmanager/type/device_resources.pb.h:127:3: error: expected identifier
  127 |   ANDROID = 4,
      |   ^
<command line>:1:17: note: expanded from macro 'ANDROID'
    1 | #define ANDROID 1
      |                 ^
1 error generated.

Hmm that seems kind of unfortunate...

@BillyONeal BillyONeal marked this pull request as draft May 1, 2026 19:38
@heksterb
Copy link
Copy Markdown
Contributor Author

heksterb commented May 2, 2026

I couldn't find the build logs; but from your snippet I'd say that

127 | ANDROID = 4,

comes from the source Protobuf definition and

:1:17: note: expanded from macro 'ANDROID'
1 | #define ANDROID 1

comes from the Android NDK.

If that's the case, this seems like a fundamental incompatibility between the Google Cloud C++ SDK and Android.

Which leads me to wonder how this ever worked at all? It's not obvious to me how the broken IAM feature (which should not have worked on any platform at all) should have passed your Android tests, while this IAM fix would have failed them?

I'm going to push another commit that disables my fix (we're in draft state anyway); I want to confirm that your tests still fail and that my fix doesn't somehow mask the failures.

@dg0yt
Copy link
Copy Markdown
Contributor

dg0yt commented May 2, 2026

I couldn't find the build logs

#31357 (comment)

@heksterb
Copy link
Copy Markdown
Contributor Author

heksterb commented May 2, 2026

Oh, sorry, you're showing me how to access the build logs— thanks.

Nevertheless: my second commit 37d35affeb79d4697d3761a30232a2e2e8e83b37 which restored the port to the 'status quo ante' also failed; confirming my suspicion that the Google Cloud C++ SDK and the Android NDK are fundamentally incompatible.

I've restored my fix (again, without this fix the iam feature does not work on any platform) and marked Android as not supported by this port: as things currently stand, CI tests on main for this port will not pass on Android.

@heksterb heksterb force-pushed the google-cloud-cpp-iamv3 branch from 9d0532a to 1b176cb Compare May 3, 2026 00:24
@BillyONeal
Copy link
Copy Markdown
Member

Nevertheless: my second commit 37d35affeb79d4697d3761a30232a2e2e8e83b37 which restored the port to the 'status quo ante' also failed; confirming my suspicion that the Google Cloud C++ SDK and the Android NDK are fundamentally incompatible.

Damn if only someone at Google knew someone at Google! (Yes I know at big companies it's never that simple but I can laugh)

@BillyONeal BillyONeal marked this pull request as ready for review May 5, 2026 05:43
@BillyONeal BillyONeal merged commit c71c709 into microsoft:master May 5, 2026
16 checks passed
@heksterb heksterb deleted the google-cloud-cpp-iamv3 branch May 5, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants