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

Undefined symbols #56

Closed
albright888 opened this issue Aug 26, 2015 · 7 comments
Closed

Undefined symbols #56

albright888 opened this issue Aug 26, 2015 · 7 comments

Comments

@albright888
Copy link

It seems no matter what I try, I cannot get around a link problem in my project:

Undefined symbols for architecture arm64:
"computeDoubleSize(int, double)", referenced from:
-[SCFrameScores serializedSize] in Asap.pb.o
"computeFloatSize(int, float)", referenced from:

It is the same for all architectures I try to build for : i386 or x86_64 or arm64
It seems that my project is not finding the protobuf library. I have tried:

  • adding ProtocolBuffers.xcodeproject as a sub projet - same problem
  • using Cocoapods to install ProtocolBuffers (1.9.8) - same problem
  • building ProtcolBuffers.xcodeproject's framework and adding manually to my project - same problem

I imagine it is some simple change, but I can't seem to find it.

Thanks for your help!

@E-B-Smith
Copy link

Make sure that Utilities.m from the ProtocolBuffers run time is included
and linked to your project.

On Wed, Aug 26, 2015 at 12:21 PM, albright888 notifications@github.com
wrote:

It seems no matter what I try, I cannot get around a link problem in my
project:

Undefined symbols for architecture arm64:
"computeDoubleSize(int, double)", referenced from:
-[SCFrameScores serializedSize] in Asap.pb.o
"computeFloatSize(int, float)", referenced from:

It is the same for all architectures I try to build for : i386 or x86_64
or arm64
It seems that my project is not finding the protobuf library. I have tried:

  • adding ProtocolBuffers.xcodeproject as a sub projet - same problem
  • using Cocoapods to install ProtocolBuffers (1.9.8) - same problem
  • building ProtcolBuffers.xcodeproject's framework and adding manually
    to my project - same problem

I imagine it is some simple change, but I can't seem to find it.

Thanks for your help!


Reply to this email directly or view it on GitHub
#56.

::: E.B. Smith
::: smith.ed.b@gmail.com
::: gmail

@albright888
Copy link
Author

The ProtcolBuffers.xcodeproject seems to have the Utilities.m is included in the ProtocolBuffers.framework build settings, so if I include this framework in my project, I should have that correct?
It is the case that all the Undefined symbols are methods from the Utilities.m file however. If I run 'nm ProtocolBuffers.framework/ProtocolBuffers' it appears these methods are in there.
I am confused.

@E-B-Smith
Copy link

Huh. If 'nm' says it's there, it is.

It seems obvious, but is the linker search path set correctly?

::: E.B. Smith
::: smith.ed.b@gmail.com
::: https://shimmering.blue
::: gmail

On Wed, Aug 26, 2015 at 2:25 PM, albright888 notifications@github.com
wrote:

The ProtcolBuffers.xcodeproject seems to have the Utilities.m is included
in the ProtocolBuffers.framework build settings, so if I include this
framework in my project, I should have that correct?
It is the case that all the Undefined symbols are methods from the
Utilities.m file however. If I run 'nm
ProtocolBuffers.framework/ProtocolBuffers' it appears these methods are in
there.

I am confused.


Reply to this email directly or view it on GitHub
#56 (comment)
.

@albright888
Copy link
Author

OK, I think I found the smoking gun. I tried a completely clean iOS project, brought in my generated proto objective-c classes, and it was working fine.
I discovered that my project had "Compile Source As" setting to Objective-C++. Turning this to "According to File Type" fixed this issue. I'm not exactly sure why the Objective-C++ setting causes these Utilities.m methods to not be found, but it does in both my projects.

@E-B-Smith
Copy link

When that option is set I think it is using C++ name mangling on the
compiled functions, and then the linker is looking for the un-mangled names.

::: E.B. Smith
::: smith.ed.b@gmail.com
::: https://shimmering.blue
::: gmail

On Fri, Aug 28, 2015 at 8:57 AM, albright888 notifications@github.com
wrote:

OK, I think I found the smoking gun. I tried a completely clean iOS
project, brought in my generated proto objective-c classes, and it was
working fine.
I discovered that my project had "Compile Source As" setting to
Objective-C++. Turning this to "According to File Type" fixed this issue.
I'm not exactly sure why the Objective-C++ setting causes these Utilities.m
methods to not be found, but it does in both my projects.


Reply to this email directly or view it on GitHub
#56 (comment)
.

@E-B-Smith
Copy link

Glad you've resolved this.

::: E.B. Smith
::: smith.ed.b@gmail.com
::: https://shimmering.blue
::: gmail

On Fri, Aug 28, 2015 at 9:01 AM, Edward Smith smith.ed.b@gmail.com wrote:

When that option is set I think it is using C++ name mangling on the
compiled functions, and then the linker is looking for the un-mangled names.

::: E.B. Smith
::: smith.ed.b@gmail.com
::: https://shimmering.blue
::: gmail

On Fri, Aug 28, 2015 at 8:57 AM, albright888 notifications@github.com
wrote:

OK, I think I found the smoking gun. I tried a completely clean iOS
project, brought in my generated proto objective-c classes, and it was
working fine.
I discovered that my project had "Compile Source As" setting to
Objective-C++. Turning this to "According to File Type" fixed this issue.
I'm not exactly sure why the Objective-C++ setting causes these Utilities.m
methods to not be found, but it does in both my projects.


Reply to this email directly or view it on GitHub
#56 (comment)
.

@albright888
Copy link
Author

Yes, thanks for your help - and nice work on this package!

@alexeyxo alexeyxo closed this as completed Sep 1, 2015
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

3 participants