Skip to content
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

Cannot find public headers when protobuf_BUILD_LIBUPB=OFF #17216

Open
zchrissirhcz opened this issue Jun 24, 2024 · 1 comment
Open

Cannot find public headers when protobuf_BUILD_LIBUPB=OFF #17216

zchrissirhcz opened this issue Jun 24, 2024 · 1 comment
Labels
cmake inactive Denotes the issue/PR has not seen activity in the last 90 days.

Comments

@zchrissirhcz
Copy link

The commit 6898451 by @mkruskal-google in 3 months ago, add ubp, but delete public headers when installation. When people build protobuf from source with protobuf_BUILD_LIBUPB=OFF, the installed cmake directory files, won't contain INTERFACE_INCLUDE_DIRECTORIES property on targets like libprotoc, libprotobuf, which will make the downstream user compile error.

I think a patch is required that determine when protobuf_BUILD_LIBUPB is OFF, still specify INTERFACE_INCLUDE_DIRECTORIES:

foreach(_library ${_protobuf_libraries})
  set_property(TARGET ${_library} # HERE
    PROPERTY INTERFACE_INCLUDE_DIRECTORIES # HERE
    $<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src> # HERE
    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) # HERE
  if (UNIX AND NOT APPLE)
    set_property(TARGET ${_library}
      PROPERTY INSTALL_RPATH "$ORIGIN")
  elseif (APPLE)
    set_property(TARGET ${_library}
      PROPERTY INSTALL_RPATH "@loader_path")
  endif()
  install(TARGETS ${_library} EXPORT protobuf-targets
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
endforeach()

commit 6898451f5e4c84e79a6f48ea6c46959960743970
Author: Mike Kruskal <mkruskal@google.com>
Date:   Tue Mar 19 20:13:17 2024 -0700

    Setup upb installation with cmake.
    
    This installs a upb's static library, headers, and three protoc plugin binaries (upb, upbdefs, upb_minitable).  These will now be enabled by default, but can be disabled by setting protobuf_BUILD_LIBUPB=OFF.
    
    To qualify this, we hook into our existing install test infrastructure which attempts to build and run our tests without any of the installation artifacts available from the source tree.  Public headers are deleted, and builds of exported libraries/binaries are disabled.
    
    PiperOrigin-RevId: 617376961
@zchrissirhcz zchrissirhcz added the untriaged auto added to all issues by default when created. label Jun 24, 2024
@zhangskz zhangskz added cmake and removed untriaged auto added to all issues by default when created. labels Jul 1, 2024
Copy link

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

@github-actions github-actions bot added the inactive Denotes the issue/PR has not seen activity in the last 90 days. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake inactive Denotes the issue/PR has not seen activity in the last 90 days.
Projects
None yet
Development

No branches or pull requests

2 participants