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

Cocoapods 0.36 CocoaLumberjack error #988

Closed
sorted-bits opened this issue Mar 25, 2015 · 38 comments
Closed

Cocoapods 0.36 CocoaLumberjack error #988

sorted-bits opened this issue Mar 25, 2015 · 38 comments

Comments

@sorted-bits
Copy link

I upgraded my project to use Cocoapods 0.36 and I started to fix the errors that causes. One of the errors I was getting is the following:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_DDLog", referenced from:
      objc-class-ref in MagicalRecord+ErrorHandling.o
      objc-class-ref in NSManagedObject+MagicalDataImport.o
      objc-class-ref in NSManagedObject+MagicalRecord.o
      objc-class-ref in NSManagedObjectContext+MagicalObserving.o
      objc-class-ref in NSManagedObjectContext+MagicalRecord.o
      objc-class-ref in NSManagedObjectContext+MagicalSaves.o
      objc-class-ref in NSObject+MagicalDataImport.o
      ...

In my project I have both CocoaLumberjack as MagicalRecord in my Podfile. I solved it by adding CocoaLumberjack.framework to the Link Binary With Libraries in the Pods-MagicalRecord target my Pods project has, but I am not sure that is the way to go.

@sorted-bits
Copy link
Author

Just a couple of test results, might help you out, I tried this on an my original project and an empty test project:

  • MR 2.2.0 with CocoaLumberjack 2.0.0 : Succeeds
  • MR 2.3.0-beta.5 with CocoaLumberjack 2.0.0 : Fails
  • MR 2.3.0-beta.6 module-support-branch with CocoaLumberjack 2.0.0 : Fails

@tonyarnold
Copy link
Contributor

I've just made some changes to the module-support branch that I hope (haven't had a chance to properly test yet) will fix CocoaLumberjack support. Would you mind having a look for me as well? Thanks!

Feel free to re-open this issue if it isn't fixed.

@benvium
Copy link

benvium commented Jun 12, 2015

@tonyarnold I'm running into the same issue (Undefined symbols for "OBJC_CLASS$_DDLog")

  • MR 2.3.0 with CocoaLumberjack 2.0.0 : Fails
use_frameworks!
pod 'MagicalRecord', '2.3.0'
pod 'CocoaLumberjack', '2.0.0'

The module-support branch is no longer there so I can't comment on that.

@pavm035
Copy link

pavm035 commented Jun 27, 2015

Same issue here. I used @depl0y solution as work around, not sure if it's the right way to go..?

@Ziewvater
Copy link

I'm having the same issue here as well. My podfile looks like this

platform :ios, '8.0'

target '[App Name]' do
    use_frameworks!
    pod "MagicalRecord", "~> 2.3.0"
    pod 'CocoaLumberjack', :git => "https://github.com/CocoaLumberjack/CocoaLumberjack.git", :branch => "swift_support"
end

I'm using the swift_support branch of CocoaLumberjack as suggested on their repo, which uses version 2.0.0.

Linking the framework in the Pods-[App Name]-MagicalRecord target like @depl0y suggested allows me to build, but seems pretty fragile since I'd need to remember to do that each time I run pod install.

@ajself
Copy link

ajself commented Jul 6, 2015

Having the same problem as well

@krypt-lynx
Copy link

Same issue.

use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

platform :'ios', '7.0'
xcodeproj '<proj1>'
link_with 'target1'

xcodeproj '<proj2>'
link_with 'target2_1'
link_with 'target2_2'

pod 'AFNetworking'
pod 'CocoaLumberjack'
pod 'MagicalRecord'

target :<...>Tests do
    pod 'OCMock', '~> 3.0.2'
    pod 'XCAsyncTestCase'
end

@ArtSabintsev
Copy link

Putting in my 2 cents as well (cc @ssoper)

@pavm035
Copy link

pavm035 commented Aug 11, 2015

Any update on this? it's the same issue here

@tonyarnold
Copy link
Contributor

No update. I haven't been using MR in any projects recently, and I haven't had the opportunity to work on it outside of hours. I'm happy to accept pull requests toward this issue.

@lolgear
Copy link

lolgear commented Sep 6, 2015

same here, any info about this issue?

Using CocoaLumberjack (2.0.1) Using MagicalRecord (2.3.0)

Works well ( as @depl0y mentioned above )
CocoaLumberjack (2.0.0)
MagicalRecord (2.2.0)

@krypt-lynx
Copy link

Issue not reproducing if async logging in CocoaLumberjack is disabled. But you need to create fork of CocoaLumberjack pod for this.

@pratik6554
Copy link

Any updates on this ?

@thomasaw
Copy link

Why is this closed? Isn't it still an issue?

@ghost
Copy link

ghost commented Sep 23, 2015

Still having problems with this. Any updates?

@melbic
Copy link
Contributor

melbic commented Sep 30, 2015

Same issue here:
pod 'CocoaLumberjack', '> 2.0'
pod 'MagicalRecord', '
> 2.3'

@melbic
Copy link
Contributor

melbic commented Sep 30, 2015

Ok, I found a workaround. The problem is, that the MagicalRecord Target doesn't link with the CocoaLumberjack Framework. (Build Phases >> Link Binary With Libraries) When one adds CocoaLumberjack as optional dependency, all works great.

@ghost
Copy link

ghost commented Sep 30, 2015

Hey Melbic, are you adding the dependency to cocoa lumberjack from Magical Record? If so then I've used this trick as a workaround too. The only issue is that every time you do a 'pod install' the dependency is wiped out. Still hoping for a permanent solution...

@melbic
Copy link
Contributor

melbic commented Sep 30, 2015

Take a look at my pull request. Using that to install MagicalRecord it works without manually linking the framework.

@lolgear
Copy link

lolgear commented Oct 27, 2015

does this error appears in Swift-based projects?

@pratik6554
Copy link

Yes.

@lolgear
Copy link

lolgear commented Oct 28, 2015

@pratik6554 and this error still exists?

In my case:
cocoapods 0.39.0
cocoalumberjack 2.1.0
magicalrecord 2.3.0
xcode 7.1
And error occurs.

I use @melbic approach and add cocoalumberjack as optional dependency - everything works fine

@pratik6554
Copy link

@lolgear Facing same issue for

pod 'MagicalRecord', '~> 2.3.0'
pod 'CocoaLumberjack/Swift'

@anton-matosov
Copy link

I have improved podspec a little bit in #1132 so subspec with CocoaLumberjack is selected automatically

@frenya
Copy link

frenya commented Dec 9, 2015

Just in case it helps anyone, here's the workaround I used.

In my Pod's Podspec file:

s.dependency 'MagicalRecord', '~> 2.3.0'
s.dependency 'CocoaLumberjack', '~> 2.0'
s.pod_target_xcconfig = {  CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }

In the actual project's Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'MagicalRecord'
            target.build_configurations.each do |config|
                config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-framework "CocoaLumberjack"']
            end
        end
    end
end

This seems to work without having to adjust build settings every time I run pod install.

P.S.: I'm not an expert on CocoaPods and/or Ruby, so if you see an error in the post_install script or know a way of including it directly in the Podspec file, feel free to comment.

P.P.S.: Let's hope MagicalRecord 2.4.0 CocoaPod contains the CocoaLumberjack subspec and this is no longer needed :)

@magicalpandatest
Copy link

Cocoa lumberjack has never been a requirement for magical record or logging to work and compile. Magical record was designed to simply connect to the logging framework if it was available.

Sent from my iPhone

On Dec 9, 2015, at 8:42 AM, Frantisek Vymazal notifications@github.com wrote:

Just in case it helps anyone, here's the workaround I used.

In my Pod's Podspec file:

s.dependency 'MagicalRecord', '> 2.3.0'
s.dependency 'CocoaLumberjack', '
> 2.0'
s.pod_target_xcconfig = { CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES' }
In the actual project's Podfile:

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'MagicalRecord'
target.build_configurations.each do |config|
config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-framework "CocoaLumberjack"']
end
end
end
end
This seems to work without having to adjust build settings every time I run pod install.

P.S.: I'm not an expert on CocoaPods and/or Ruby, so if you see an error in the post_install script or know a way of including it directly in the Podspec file, feel free to comment.

P.P.S.: Let's hope MagicalRecord 2.4.0 CocoaPod contains the CocoaLumberjack subspec and this is no longer needed :)


Reply to this email directly or view it on GitHub.

@frenya
Copy link

frenya commented Dec 9, 2015

Exactly! And since it's not a requirement (and therefore the pod's dependency), it's not linked in by default. This is what's causing the headache - the conditional compile sees the CocoaLumberjack header, imports it and starts using it, but in the link phase, the library is not added, causing the _(Undefined symbols for "OBJC_CLASS$DDLog") error.

Just to be clear - my comment wasn't meant to be confrontational. Apparently, this has already been fixed in the master branch by the subspec. Unfortunately, this change has not yet propagated into the CocoaPods repo.

And since I'm not allowed to use the :git option in Podspec, I'm dependant on the main repo. With my workaround, I was just trying to help other people in the same situation :)

@serkrapiv
Copy link

@frenya this post install fix doesn't work for me in my application's podfile

@danielgalasko
Copy link

Also seeing this

pod 'MagicalRecord', '2.3.0'
pod 'CocoaLumberjack', '2.2.0'

@Nikita2k
Copy link

Nikita2k commented Jan 9, 2016

Same for me

Using CocoaLumberjack (2.2.0)
Using MagicalRecord (2.3.0)

@anton-matosov
Copy link

There is a solution for this problem (#1101)
It was merged into the main repo but for some reason not yet submitted to CocoaPods master specs repo.
In order to fix linker issue update the podfile entry to:

 pod "MagicalRecord/CocoaLumberjack", :git => "https://github.com/magicalpanda/MagicalRecord.git"

P.S.
I have not tried this with Swift.

@rahulmeena13
Copy link

@anton-matosov Checked with swift, working fine.

@tonyarnold
Copy link
Contributor

Sorry guys, I've been swamped — I released version 2.3.2 a couple of days ago, which should address this issue. Feel free to reopen this issue if it doesn't.

@semireg
Copy link

semireg commented Jan 26, 2016

Version 2.3.2 from branch MagicalRecord/CocoaLumberjack works for me. However, the default podspec when using "pod 'MagicalRecord' doesn't work for me. Both show version 2.3.2, though... weird.

@santiago
Copy link

santiago commented Mar 3, 2016

After fixing the Undefined symbols issue by installing from 'MagicalRecord/CocoaLumberjack' I start seeing these other errors.

Any ideas on what might be going on?

@xradeon
Copy link

xradeon commented Mar 9, 2016

I still have the issue with the default podspec using 'pod MagicalRecord'. It shows version 2.3.2 too..

@anton-matosov
Copy link

Default podspec should not fix the issue. CocoaLumberjack is optional component and if you use it, you should use another subspec

@xradeon
Copy link

xradeon commented Mar 9, 2016

In fact I wasn't using it. I installed the appodeal pod, then the issue appeared. Even uninstalling the appodeal pod didn't solve the problem. I solved it deleting derived data folder. Thanks!

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

No branches or pull requests