Hello,

I am working on a library where I would use protobuf. 

I need to link it statically. The target platform is macOS. 

The usual way of fetching dependencies (brew install protobuf) is no go, as 
it comes only with shared libraries.

I tried forcing homebrew to rebuild protobuf (brew install protobuf 
--build-from-source) but it fails as some tests are not passing (logs [1] 
at the end of this message).

I fetched the source code (27.3) release from github, run 

bazel build :portico :protobuf 

inside the source directory, but while it compiles protoc compiler, there's 
no CMake/protobuf-lite library in the output.

Apparently the runtime is based on CMake, so I run 

cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_STANDARD=17 
-Dprotobuf_ABSL_PROVIDER=package -Dprotobuf_JSONCPP_PROVIDER=package

and then issued compilation in build/ dir, and yay, it compiled protobuf.

However, when I added the build/cmake to CMAKE_PREFIX_PATH it complains 
about missing build/cmake/protobuf/protobuf-targets.cmake

So I tried adding the repository as git submodule, and adding it via 
add_subdirectory CMake command, then it fails with

CMake Error: install(EXPORT "protobuf-targets" ...) includes target 
"libprotobuf-lite" which requires target "absl_absl_check" that is not in 
any export set.
CMake Error: install(EXPORT "protobuf-targets" ...) includes target 
"libprotobuf-lite" which requires target "absl_absl_log" that is not in any 
export set.
CMake Error: install(EXPORT "protobuf-targets" ...) includes target 
"libprotobuf-lite" which requires target "absl_algorithm" that is not in 
any export set.
CMake Error: install(EXPORT "protobuf-targets" ...) includes target 
"libprotobuf-lite" which requires target "absl_base" that is not in any 
export set.
...

abseil is added as add_subdirectory as well.

I run into conclusion that I must be doing something fundamentally wrong, 
as I don't expect such popular piece of code to be so hard to integrate.

Any suggestions on how to properly embed protobuf within such a project?

Thanks in advance,

Marcin

[1] Failed tests:

2: [ RUN      ] TextFormatParserTest.ParseFieldValueFromString
2: E0000 00:00:1723926116.158054 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: a
2: E0000 00:00:1723926116.158063 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range 
(999999999999999999999999999999999999)
2: E0000 00:00:1723926116.158079 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: a
2: E0000 00:00:1723926116.158082 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range 
(999999999999999999999999999999999999)
2: E0000 00:00:1723926116.158084 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: -
2: E0000 00:00:1723926116.158085 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: a
2: E0000 00:00:1723926116.158087 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range 
(999999999999999999999999999999999999)
2: E0000 00:00:1723926116.158089 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: -
2: E0000 00:00:1723926116.158090 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: a
2: E0000 00:00:1723926116.158092 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range 
(999999999999999999999999999999999999)
2: E0000 00:00:1723926116.158094 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: -
2: E0000 00:00:1723926116.158095 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected integer, got: a
2: E0000 00:00:1723926116.158097 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range 
(999999999999999999999999999999999999)
2: E0000 00:00:1723926116.158101 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:5: Invalid value for boolean 
field "optional_bool". Value: "tRue".
2: E0000 00:00:1723926116.158106 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:6: Invalid value for boolean 
field "optional_bool". Value: "faLse".
2: E0000 00:00:1723926116.158108 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Integer out of range (2)
2: E0000 00:00:1723926116.158109 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected identifier, got: -
2: E0000 00:00:1723926116.158111 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:3: Invalid value for boolean 
field "optional_bool". Value: "on".
2: E0000 00:00:1723926116.158113 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:2: Invalid value for boolean 
field "optional_bool". Value: "a".
2: E0000 00:00:1723926116.158130 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected double, got: a
2: E0000 00:00:1723926116.158132 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected double, got: a
2: E0000 00:00:1723926116.158134 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expect a decimal number, 
got: 0xf
2: E0000 00:00:1723926116.158136 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expect a decimal number, 
got: 012
2: E0000 00:00:1723926116.158138 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected string, got: hello
2: E0000 00:00:1723926116.158141 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:7: Unknown enumeration value 
of "FOOBAR" for field "optional_nested_enum".
2: E0000 00:00:1723926116.158143 5519321 text_format.cc:417] Error parsing 
text-format protobuf_unittest.TestAllTypes: 1:1: Expected "{", found "any".

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/bfc0b7c6-0147-4ffa-ad03-257c3da5c832n%40googlegroups.com.

Reply via email to