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

Incorrect pkg-config metadata for windows with shared abseil builds #15883

Closed
h-vetinari opened this issue Feb 20, 2024 · 0 comments
Closed

Incorrect pkg-config metadata for windows with shared abseil builds #15883

h-vetinari opened this issue Feb 20, 2024 · 0 comments

Comments

@h-vetinari
Copy link
Contributor

I realize that using -Dprotobuf_ABSL_PROVIDER="package" (much less with shared abseil) is not the most common scenario, but it's very important in our distribution which serves many thousands of users (e.g. the most recent libprotobuf build has >160k downloads in the last two weeks).

And for the purposes of a distribution, where the builds of protobuf will themselves again be built against by other libraries (sometimes with different build systems), it's good to have accurate pkg-config data.

However, protobuf currently generates incorrect metadata in the above-mentioned scenario, mainly because shared abseil does something weird on windows, which is to stick everything into one abseil_dll.dll, thus breaking the absl_foo pattern. The end result is that the pkg-config file contains

Requires: absl_abseil_dll ...

which then results in something like:

Package absl_abseil_dll was not found in the pkg-config search path.

What version of protobuf and what language are you using?

Version: v25.1 / v25.2
Language: C++

What operating system (Linux, Windows, ...) and version?

Windows

What runtime / compiler are you using (e.g., python version or gcc version)

VS2019 (16.11 / 14.29.30139)

What did you do?

Steps to reproduce the behavior:
Run conda-forge recipe, which mainly does:

cmake -G "Ninja" ^
    -DCMAKE_BUILD_TYPE=Release ^
    -DCMAKE_CXX_STANDARD=17 ^
    -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
    -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
    -Dprotobuf_ABSL_PROVIDER="package" ^
    -Dprotobuf_BUILD_SHARED_LIBS=ON ^
    -Dprotobuf_JSONCPP_PROVIDER="package" ^
    -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ^
    -Dprotobuf_USE_EXTERNAL_GTEST=ON ^
    -Dprotobuf_WITH_ZLIB=ON ^
    ..

What did you expect to see

Correct pkg-config metadata

What did you see instead?

content of installed protobuf.pc (similar for protobuf-lite.pc):

prefix=<snip>
exec_prefix=<snip>
libdir=<snip>
includedir=<snip>

Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: 25.1.0
Requires: absl_abseil_dll utf8_range        # <-- wrong
Libs: -L${libdir} -lprotobuf 
Cflags: -I${includedir} -DPROTOBUF_USE_DLLS
Conflicts: protobuf-lite

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

@h-vetinari h-vetinari added the untriaged auto added to all issues by default when created. label Feb 20, 2024
@honglooker honglooker removed the untriaged auto added to all issues by default when created. label Feb 20, 2024
deannagarcia pushed a commit to deannagarcia/protobuf that referenced this issue Jun 20, 2024
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 a pull request may close this issue.

2 participants