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

Building 1.63.0 or newer on macOS fails. #36654

Open
moubctez opened this issue May 17, 2024 · 4 comments
Open

Building 1.63.0 or newer on macOS fails. #36654

moubctez opened this issue May 17, 2024 · 4 comments

Comments

@moubctez
Copy link

What version of gRPC and what language are you using?

1.63.0 1.64.0

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

macOS

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

clang

What did you do?

Try to build 1.63.0 or 1.64.0 (older versions are fine).

What did you expect to see?

Builds fine

What did you see instead?

Build fails with

Undefined symbols for architecture arm64:
 "_google__protobuf__EnumOptions_msg_init", referenced from:
     __upb_EnumDefs_New in enum_def.c.o
     __upb_EnumDefs_New in enum_def.c.o
     __upb_EnumDefs_New in enum_def.c.o
 "_google__protobuf__EnumValueOptions_msg_init", referenced from:
     __upb_EnumValueDefs_New in enum_value_def.c.o
     __upb_EnumValueDefs_New in enum_value_def.c.o
     __upb_EnumValueDefs_New in enum_value_def.c.o
 "_google__protobuf__ExtensionRangeOptions_msg_init", referenced from:
     __upb_ExtensionRanges_New in extension_range.c.o
     __upb_ExtensionRanges_New in extension_range.c.o
     __upb_ExtensionRanges_New in extension_range.c.o
 "_google__protobuf__FeatureSetDefaults_msg_init", referenced from:
     _upb_DefPool_SetFeatureSetDefaults in def_pool.c.o
     _upb_DefPool_SetFeatureSetDefaults in def_pool.c.o
 "_google__protobuf__FeatureSet_msg_init", referenced from:
     _upb_DefBuilder_AddFileToPool in def_pool.c.o
     __upb_FieldDef_Create in field_def.c.o
     __upb_DefBuilder_GetOrCreateFeatureSet in def_builder.c.o
     __upb_DefBuilder_DoResolveFeatures in def_builder.c.o
     __upb_DefBuilder_DoResolveFeatures in def_builder.c.o
 "_google__protobuf__FieldOptions_msg_init", referenced from:
     __upb_FieldDef_Create in field_def.c.o
     __upb_FieldDef_Create in field_def.c.o
 "_google__protobuf__FileDescriptorProto_msg_init", referenced from:
     __upb_DefPool_LoadDefInitEx in def_pool.c.o
     __upb_DefPool_LoadDefInitEx in def_pool.c.o
 "_google__protobuf__FileOptions_msg_init", referenced from:
     __upb_FileDef_Create in file_def.c.o
     __upb_FileDef_Create in file_def.c.o
 "_google__protobuf__MessageOptions_msg_init", referenced from:
     __upb_MessageDefs_New in message_def.c.o
     __upb_MessageDefs_New in message_def.c.o
     __upb_MessageDefs_New in message_def.c.o
 "_google__protobuf__MethodOptions_msg_init", referenced from:
     __upb_MethodDefs_New in method_def.c.o
     __upb_MethodDefs_New in method_def.c.o
     __upb_MethodDefs_New in method_def.c.o
 "_google__protobuf__OneofOptions_msg_init", referenced from:
     __upb_OneofDefs_New in oneof_def.c.o
     __upb_OneofDefs_New in oneof_def.c.o
     __upb_OneofDefs_New in oneof_def.c.o
 "_google__protobuf__ServiceOptions_msg_init", referenced from:
     __upb_ServiceDefs_New in service_def.c.o
     __upb_ServiceDefs_New in service_def.c.o
     __upb_ServiceDefs_New in service_def.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Anything else we should know about your project / environment?

Fix:

--- CMakeLists.txt.orig	2024-05-16 01:01:03.000000000 +0000
+++ CMakeLists.txt
@@ -3682,6 +3682,7 @@ target_include_directories(upb_json_lib
 )
 target_link_libraries(upb_json_lib
   ${_gRPC_ALLTARGETS_LIBRARIES}
+  grpc++_unsecure
   utf8_range_lib
   upb_message_lib
 )
@@ -3883,6 +3884,7 @@ target_include_directories(upb_textforma
 )
 target_link_libraries(upb_textformat_lib
   ${_gRPC_ALLTARGETS_LIBRARIES}
+  grpc++_unsecure
   utf8_range_lib
   upb_message_lib
 )
@eugeneo
Copy link
Contributor

eugeneo commented May 17, 2024

Thank you for this report. Can you clarify what targets were you trying to build? Please confirm if you obtained gRPC from our GitHub repository or from some other place.

@moubctez
Copy link
Author

I guess this is all targets with cmake argsuments: -DBUILD_SHARED_LIBS=ON -DgRPC_ABSL_PROVIDER=package -DgRPC_BENCHMARK_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_RE2_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package.

I confirm the release tarball is from the official GitHub release.

To be more specific, I build the package using PkgSrc where I've incorporated the patch: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/grpc/?only_with_tag=MAIN

@jcar87
Copy link

jcar87 commented Jun 5, 2024

Facing the same problem - building the shared library on macOS with all dependencies provided externally. Using protobuf 27

I can see homebrew's test bot is also experiencing this:
Homebrew/homebrew-core#170194

@h-vetinari
Copy link
Contributor

Anything else we should know about your project / environment?

Fix:

--- CMakeLists.txt.orig	2024-05-16 01:01:03.000000000 +0000
+++ CMakeLists.txt
@@ -3682,6 +3682,7 @@ target_include_directories(upb_json_lib
 )
 target_link_libraries(upb_json_lib
   ${_gRPC_ALLTARGETS_LIBRARIES}
+  grpc++_unsecure
   utf8_range_lib
   upb_message_lib
 )
@@ -3883,6 +3884,7 @@ target_include_directories(upb_textforma
 )
 target_link_libraries(upb_textformat_lib
   ${_gRPC_ALLTARGETS_LIBRARIES}
+  grpc++_unsecure
   utf8_range_lib
   upb_message_lib
 )

This doesn't work (for shared builds) because it creates a cyclic dependence, as grpc++_unsecure itself depends on those two libraries.

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

No branches or pull requests

6 participants