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

Add podspec for C++ #6404

Merged
merged 1 commit into from Jul 23, 2019
Merged

Add podspec for C++ #6404

merged 1 commit into from Jul 23, 2019

Conversation

rmstar
Copy link
Contributor

@rmstar rmstar commented Jul 18, 2019

No description provided.

@muxi
Copy link

muxi commented Jul 18, 2019

@thomasvl - PTAL

Protobuf-cc.podspec Outdated Show resolved Hide resolved
Protobuf-cc.podspec Outdated Show resolved Hide resolved
Protobuf-cc.podspec Outdated Show resolved Hide resolved
php/ext/google/protobuf/package.xml Outdated Show resolved Hide resolved
@thomasvl
Copy link
Contributor

@muxi - The protobuf team will also have to agree to maintain/updating this like they do the objc one with releases.

Protobuf-cc.podspec Outdated Show resolved Hide resolved
@muxi
Copy link

muxi commented Jul 18, 2019

Sounds good. We will ask them about it. Thanks!

@thomasvl
Copy link
Contributor

@muxi this seems fine to me, so you'll need to get someone on the protobuf team for final sign off on name (i.e. - Protobuf-cc or something else) and also that why want to maintain/publish this with releases.

@muxi
Copy link

muxi commented Jul 19, 2019

@thomasvl - we will get this done. Thank you for the help again Thomas.

@@ -250,6 +250,11 @@ def UpdateObjectiveC():
r"^ s.version = '.*'$",
" s.version = '%s'" % GetFullVersion(rc_suffix = '-rc'),
line))
RewriteTextFile('Protobuf-cc.podspec',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc to c++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that. Fixed.

@TeBoring TeBoring self-assigned this Jul 23, 2019
@TeBoring TeBoring merged commit 2c76c2c into protocolbuffers:master Jul 23, 2019
@shali3
Copy link

shali3 commented Dec 16, 2019

Hi there,
I'm posting this here for others that try to use it.
I tried using it with:

  pod 'Protobuf-C++', :git => 'https://github.com/protocolbuffers/protobuf.git', :tag => 'v3.11.2'

and the Protobuf-C++ target doesn't compile.
Looks like a header path issue (I have a bunch of those):

...../Pods/Protobuf-C++/src/google/protobuf/any.cc:31:10: fatal error: 'google/protobuf/any.h' file not found
#include <google/protobuf/any.h>
         ^~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

After digging around looks like this pod does not support the use_frameworks! configuration.
After switching this off it looks like it's working :)

I have 2 questions for you:

  1. Are you planning to publish this package to cocoapods anytime soon?
  2. Are you planning to support useframeworks! option?

Regarding question 2, I managed to compile it by manually adding this search path to Protobuf-C++ pod target.

${PODS_TARGET_SRCROOT}/src

You can do it in the podspec file like so:

  spec.pod_target_xcconfig = {
    'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/src"'
  }

But it crashes on startup with the following error:

dyld: Library not loaded: @rpath/Protobuf_C_.framework/Protobuf_C_
  Referenced from: /Users/myuser/Library/Developer/CoreSimulator/Devices/BC55661B-9EC5-4EF1-A071-BC69ABA420AE/data/Containers/Bundle/Application/DBFE7F24-6521-4639-A0FD-E14B07DEB389/ios-sample.app/ios-sample
  Reason: image not found

You can clone this repo to reproduce the issue:

git clone https://github.com/shali3/ios-single-view-app.git

@zzzworm
Copy link

zzzworm commented May 11, 2021

Hi there,
I'm posting this here for others that try to use it.
I tried using it with:

  pod 'Protobuf-C++', :git => 'https://github.com/protocolbuffers/protobuf.git', :tag => 'v3.11.2'

and the Protobuf-C++ target doesn't compile.
Looks like a header path issue (I have a bunch of those):

...../Pods/Protobuf-C++/src/google/protobuf/any.cc:31:10: fatal error: 'google/protobuf/any.h' file not found
#include <google/protobuf/any.h>
         ^~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

After digging around looks like this pod does not support the use_frameworks! configuration.
After switching this off it looks like it's working :)

I have 2 questions for you:

  1. Are you planning to publish this package to cocoapods anytime soon?
  2. Are you planning to support useframeworks! option?

Regarding question 2, I managed to compile it by manually adding this search path to Protobuf-C++ pod target.

${PODS_TARGET_SRCROOT}/src

You can do it in the podspec file like so:

  spec.pod_target_xcconfig = {
    'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}/src"'
  }

But it crashes on startup with the following error:

dyld: Library not loaded: @rpath/Protobuf_C_.framework/Protobuf_C_
  Referenced from: /Users/myuser/Library/Developer/CoreSimulator/Devices/BC55661B-9EC5-4EF1-A071-BC69ABA420AE/data/Containers/Bundle/Application/DBFE7F24-6521-4639-A0FD-E14B07DEB389/ios-sample.app/ios-sample
  Reason: image not found

You can clone this repo to reproduce the issue:

git clone https://github.com/shali3/ios-single-view-app.git

I have the same issue, please fix it!

@shali3
Copy link

shali3 commented May 12, 2021

This is a workaround you can do on your Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'Protobuf-C++'
        # Pure C++ doesn't support framework imports. We need to help it find it's path.
        target.build_configurations.each do |config|
          config.build_settings['HEADER_SEARCH_PATHS'] = "${PODS_TARGET_SRCROOT}/src";
        end
      end
    end
  end
end

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

Successfully merging this pull request may close these issues.

None yet

8 participants