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

[grpc] pkg-config files have upb dependencies in the wrong order #26751

Closed
coryan opened this issue Sep 10, 2022 · 0 comments · Fixed by #26752
Closed

[grpc] pkg-config files have upb dependencies in the wrong order #26751

coryan opened this issue Sep 10, 2022 · 0 comments · Fixed by #26752
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@coryan
Copy link
Contributor

coryan commented Sep 10, 2022

Describe the bug

Compiling code that uses gRPC via pkg-config produces link errors. The list of -lupb_* options seem to be in the wrong order.

Environment

  • OS: Linux
  • Compiler: gcc 12

To Reproduce

I am sure this can happen with a smaller repro, but this is how I got it.

  1. $HOME/vcpkg-develop/vcpkg install google-cloud-cpp[core,speech]
  2. git clone https://github.com/googleapis/google-cloud-cpp
  3. cd google-cloud-cpp/google/cloud/speech/quickstart
  4. PKG_CONFIG_PATH=$HOME/vcpkg-develop/installed/x64-linux/lib/pkgconfig make
  5. See error
/usr/bin/ld: /usr/local/google/home/coryan/vcpkg-develop/installed/x64-linux/lib/pkgconfig/../../lib/libupb.a(decode.c.o): in function `decode_tomsg':
decode.c:(.text+0x1217): undefined reference to `utf8_naive'
/usr/bin/ld: /usr/local/google/home/coryan/vcpkg-develop/installed/x64-linux/lib/pkgconfig/../../lib/libupb.a(decode.c.o): in function `decode_toarray':
decode.c:(.text+0x1a87): undefined reference to `utf8_naive'
collect2: error: ld returned 1 exit status
make: *** [Makefile:36: quickstart] Error 1

Expected behavior

A successful build.

Additional context

When building with CMake the upb dependencies are linked in this order:

libupb_json.a
libupb_textformat.a 
libupb_reflection.a 
libupb.a 
libupb_fastdecode.a 
libupb_utf8_range.a 
libdescriptor_upb_proto.a

Whereas the port for gRPC applies a patch

00014-pkgconfig-upbdefs.patch

which adds these dependencies to the pkg-config file in a different order:

+ "-lgrpc -laddress_sorting -lre2 -ldescriptor_upb_proto -lupb_fastdecode -lupb_json -lupb_reflection -lupb_textformat -lupb_utf8_range -lupb -lcares -lz"

I think it is a matter of reordering the upb libraries in the pkgconfig patch. I will try to submit a PR to fix this.

@Adela0814 Adela0814 added the category:port-bug The issue is with a library, which is something the port should already support label Sep 13, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants