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

'google/protobuf/port_def.inc' file not found #20

Open
peixuan197 opened this issue Mar 17, 2021 · 3 comments
Open

'google/protobuf/port_def.inc' file not found #20

peixuan197 opened this issue Mar 17, 2021 · 3 comments

Comments

@peixuan197
Copy link

1、clone the code
2、open with Xcode 12.2 then I got this error:

image

@CooperCorona
Copy link
Collaborator

Hi peixuan197.

Try creating a file named Podfile in the root directory (the same folder containing GTXiLib.xcodeproj) with these contents:

target 'GTXiLib' do
  pod 'Protobuf-C++'
end

Then run pod install, and open GTXiLib.xcworkspace. Not GTXiLib.xcodeproj. You can install CocoaPods using gem or Homebrew.

GTXiLib now requires Protobuf support. By far the easiest way to support this is CocoaPods. You can build Protobuf from source, but it's much more complicated. You need to build the proto compiler for "cross compilation", because you're running the compiler on MacOS but generating output for iOS.

@kkorouei
Copy link

The newest version has fixed this issue. See below:

Your Podfile should look like

use_modular_headers!
target "NameOfYourProject" do
  pod "GTXiLib"
end

with an optional version specifier for "GTXiLib". Note the use_modular_headers! line and the lack of use_frameworks!. As of CocoaPods 1.5.0, use_frameworks! is no longer required for Swift projects. use_frameworks! makes Protobuf-C++, which is a dependency of GTXiLib, fail to import properly. Thus, you cannot use use_frameworks!, which means you must use use_modular_headers!. You may also specify :modular_headers => true on a per-pod basis. Then, add import GTXiLib to your Swift files, and you can use GTXiLib APIs.

I should note that I wasn't able to make this work using the per-pod basis installation (:modular_headers=>true)

An alternative approach is to use version 3.1.0 which doesn't use Protobuf.

@pranav-vempati
Copy link

CooperCorona's recommendation to use the 'Protobuf-C++' pod in conjunction with specifying use_modular_headers! as kkorouei suggested did the trick for me.

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

No branches or pull requests

4 participants