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

Apple Mach-O Linker Error #146

Closed
CrazyGoose opened this issue May 5, 2017 · 29 comments
Closed

Apple Mach-O Linker Error #146

CrazyGoose opened this issue May 5, 2017 · 29 comments

Comments

@CrazyGoose
Copy link

Pod is installed correctly. Followed all setup as outlined but I am getting the following errors:

"OBJC_CLASS$_DBClientsManager", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I comment out: [DBClientsManager setupWithAppKey:@"XXXXXXXXXX"]; everything complies without issue.

@scobbe
Copy link
Contributor

scobbe commented May 5, 2017

@CrazyGoose: Do you have the .xcworkspace file open and not the .xcodeproj file?

@CrazyGoose
Copy link
Author

CrazyGoose commented May 5, 2017

I get errors with both.

Xcodeproj -> One error.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

xcworkspace -> two errors
"OBJC_CLASS$_DBClientsManager", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@scobbe
Copy link
Contributor

scobbe commented May 5, 2017

@CrazyGoose: To get the obvious stuff out of the way, would you mind confirming that you've restarted Xcode, and then run cmd+option+shift+k and done a clean build?

@CrazyGoose
Copy link
Author

Yes,

I have cleaned derived data, restarted xcode, uninstalled pod, reinstalled pod.... many combination of each.

It is the minute I put in the code: [DBClientsManager setupWithAppKey:@"XXXXXXXXXX"];
The actual line of code does not show any errors. But it just wont compile.

@scobbe
Copy link
Contributor

scobbe commented May 5, 2017

Would you mind trying the step here that involves adding $(inherited) to your project's Other Linker Flags in Build Settings, and ensure that the -ObjC flag is included in Other Linker Flags?

DBClientsManager uses categories, which can fail at link time sometimes if the -ObjC flag isn't added

@CrazyGoose
Copy link
Author

CrazyGoose commented May 5, 2017

I believe it is already there.

screen shot 2017-05-05 at 5 21 20 pm

@scobbe
Copy link
Contributor

scobbe commented May 5, 2017

@CrazyGoose: Ok, thanks. Another thing – set BUILD ACTIVE ARCHITECTURE ONLY to NO for both debug and release in your project's build settings. Let me know if that helps at all.

@scobbe
Copy link
Contributor

scobbe commented May 5, 2017

Also, if you run pod --version and it's less than 0.25.0, you may need to update (sudo gem update cocoapods)

@CrazyGoose
Copy link
Author

Pod version 1.2.1
Changed Active Arch.. to NO for Debug. Release was already NO.

@scobbe
Copy link
Contributor

scobbe commented Jun 1, 2017

@CrazyGoose: Sorry for the radio silence here. Wanted to follow up and see if this issue was still happening for you. If it is, would you mind sending in a redacted Xcode project to the following link:

https://www.dropbox.com/developers/contact

That way, we can debug it on our end and get to the bottom of this. Either way, let me know. Thank you!

@Schwiiz
Copy link

Schwiiz commented Jun 5, 2017

Hi scobbe, could you please help me with the same problem:
ld: framework not found Pods-DBRoulette
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm trying to run the sample code + all you suggestions above tried
thanks!

@scobbe
Copy link
Contributor

scobbe commented Jun 5, 2017

@Schwiiz: I assume you tried everything above?

Based on your error, it seems like you don't have the .xcworkspace file open (but instead the .xcodeproj file).

Would you mind confirming that you have the .xcworkspace file open while attempting to build?

@Schwiiz
Copy link

Schwiiz commented Jun 5, 2017

unfortunately, it's .xcworkspace. it looks like this:

screen shot 2017-06-05 at 18 58 10

@scobbe
Copy link
Contributor

scobbe commented Jun 5, 2017

@Schwiiz: Oh this is the example project. Did you run pod install in the directory that contains the Podfile?

We don't distribute the framework code (ObjectiveDropboxOfficial) in the examples directly, but instead require you to fetch them. Let me know if this works.

@scobbe
Copy link
Contributor

scobbe commented Jun 5, 2017

Oh wait, yeah we don't distribute the workspace files either, so you must have...

@scobbe
Copy link
Contributor

scobbe commented Jun 5, 2017

@Schwiiz: Would you mind trying this:

In Project Navigator in the folder Pods look for Pods_DBRoulette.framework which is red in the above screenshot. It should also be present in Linked Frameworks and Libraries. Remove both references and see if that helps.

@Schwiiz
Copy link

Schwiiz commented Jun 5, 2017

@scobbe ok, let me try. thanks.

@scobbe
Copy link
Contributor

scobbe commented Jun 6, 2017

@Schwiiz: Any word?

@scobbe
Copy link
Contributor

scobbe commented Jun 12, 2017

Ping @Schwiiz and @CrazyGoose.

Any update? Where you able to get this to work?

@igiso
Copy link

igiso commented Oct 10, 2017

I get a mac o linker Error
OBJC_CLASS$_DBClientsManager", referenced from: objc-class-ref in ofxDropBox.o

When I run on Ipad,
but on simulator everything runs ok?
Any Ideas?

screen shot 2017-10-10 at 15 36 48

screen shot 2017-10-10 at 15 36 25

screen shot 2017-10-10 at 15 35 59

screen shot 2017-10-10 at 15 28 09

@greg-db
Copy link
Contributor

greg-db commented Oct 10, 2017

@igiso Have you already tried the troubleshooting steps discussed earlier in this thread?

@igiso
Copy link

igiso commented Oct 19, 2017

Yes I've tried, everything, I need to clarify, that my project works on Simulator, the linking problem is when testing on Device.

@igiso
Copy link

igiso commented Oct 19, 2017

ps
I didn't run those Pod files, I just dragged the ObjectiveDropboxOfficial.framework into the project

I tried to run them, but it made any difference

screen shot 2017-10-19 at 16 16 52

@igiso
Copy link

igiso commented Oct 19, 2017

On the simulator I get this warning but it compiles:

screen shot 2017-10-19 at 16 22 03

@igiso
Copy link

igiso commented Oct 19, 2017

I am putting a reference to this I think it is related:

drewmccormack/ensembles#208

@igiso
Copy link

igiso commented Oct 19, 2017

I've solved the problem, I had to rebuild the framework for the particular device and then relink it,
but now it doesn't work on the simulator,

I created two projects with shared code but different linked frameworks..

@greg-db
Copy link
Contributor

greg-db commented Oct 19, 2017

@igiso The SDK should work both on device and in the simulator. You'll need to pick one of the supported installation methods though, and follow all of the documented steps:

https://github.com/dropbox/dropbox-sdk-obj-c#sdk-distribution

It sounds like you only manually dragged in the ObjectiveDropboxOfficial.framework. To get this working, please try again using one of the officially supported installation methods.

@monish152
Copy link

screen shot 2019-01-13 at 11 58 52 pm
@scobbe getting same issue while adding manually. There is only xcodeproj file

@greg-db
Copy link
Contributor

greg-db commented Jan 14, 2019

@monish152 I see you opened a new issue for your error (#238), so I'll follow up with you there to avoid spamming the other people on this old one.

@greg-db greg-db closed this as completed Jan 14, 2019
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

6 participants