React-native-background-geolocation: build failed with linker issues

Created on 8 Apr 2021  路  30Comments  路  Source: transistorsoft/react-native-background-geolocation

Your Environment

  • Plugin version: 4.0.2
  • Platform: iOS or Android
  • OS version: 14.4
  • Device manufacturer / model: Iphone 11
  • React Native version (react-native - 0.61.5):
  • Plugin config
    ```javascript
    PASTE_YOUR_CODE_HERE
## Expected Behavior
application will run normally

## Actual Behavior
crash build show error build failed 


## Context
<!--- What were you trying to do? -->

## Debug logs

Showing All Errors Only
Undefined symbol: _OBJC_IVAR_$_DDLogMessage._tag

<details><summary>application will show a build failed error i and i have install pod CocoaLumberjack</summary>

``` <!-- Syntax highlighting:  DO NOT REMOVE -->
- RNBackgroundGeolocation (4.0.2):
    - CocoaLumberjack (~> 3.7.0)
    i have install the pod and install library sucessfully and do all the steps but build failed

Most helpful comment

@WaseemAhmed645, @ziyaddin [email protected] is released to npm with CocoaLumberjack pinned @ 3.7.0

All 30 comments

Undefined symbols for architecture x86_64:
"_OBJC_IVAR_$_DDLogMessage._tag", referenced from:
-[TSLogFormatter formatLogMessage:] in TSLocationManager(TSLogFormatter.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

"react-native-background-fetch": "^4.0.1",
"react-native-background-geolocation": "^4.0.2",

Is this your first time installing or are you upgrading the plugin?

The issue persists, even trying:

cd ios
pod install

did not help. For me, it is not my first time, I have just done regular pod update after upgrading some other dependencies and then got this issue.

This has happened to me a few times recently with other projects. npx react-native-clean-project (and specifically clearing the Xcode build cache, whether that is in ios/build or ~/Library/big/xcode/path/to/DerivedData - which react-native-clean-project takes care of)

Encountering this same error since yesterday. Happens on both 3.1.0 and 4.0.2.

Undefined symbols for architecture arm64:
"_OBJC_IVAR_$_DDLogMessage._tag", referenced from:
-[TSLogFormatter formatLogMessage:] in TSLocationManager(TSLogFormatter.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've tried npx react-native-clean-project .

"react-native": "0.64.0",

The plugin recently updated its version of CocoaLumberjack. Anything prefixed with DD comes from CocoaLumberjack.

Your app is not installing the updated CocoaLumberjack Pod.

I verified that my app does have the CocoaLumberjack pod installed (v 3.7.1) but the issue still persists.

It could be related to https://github.com/CocoaLumberjack/CocoaLumberjack/issues/1221.

I have latest version of CocoaLumberjack successfully installed in the SampleApps for Flutter, React Native and Cordova.

I suggest you create a fresh new Hello World app, install the background-geolocation and see if it succeeds.

And no: your linked issue to CocoaLumberjack is not related.

This has happened to me a few times recently with other projects. npx react-native-clean-project (and specifically clearing the Xcode build cache, whether that is in ios/build or ~/Library/big/xcode/path/to/DerivedData - which react-native-clean-project takes care of)

@mikehardy Thanks for this great tip. It helped to solve 'TSBackgroundFetch/TSBackgroundFetch.h' file not found error that I have recently got due to broken pod update but unfortunately, the main issue still persists.

Chris's advice to do the example app (or a clean app from npx react-native init is best then. This is likely some Xcode project architecture exclusion or something specific to your project, and a clean project will show it

I am reproducing this in my work project as well. Still a few variables on my side that I need to eliminate as possible sources of the error but...something is odd.

This was from a CI type release build via fastlane, that failed on the archive step while cross-compiling/linking from MacBook Pro intel host to armv7 target

update: failed for me on a debug build as well, MacBook Pro intel host, missing symbols were for architecture x86_64 - note this project was building just fine as recently as a couple days ago. Entropy, my old friend.

[16:35:17]: ? Undefined symbols for architecture armv7:
[16:35:17]: ?   "_OBJC_IVAR_$_DDLogMessage._tag", referenced from:
[16:35:17]: ?       -[TSLogFormatter formatLogMessage:] in TSLocationManager(TSLogFormatter.o)
Please update using `gem install fastlane`
(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % cat ios/Podfile* | grep geolocation
  - RNBackgroundGeolocation (from `../node_modules/react-native-background-geolocation-android`)
    :path: "../node_modules/react-native-background-geolocation-android"
(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % cat ios/Podfile* | grep CocoaLumberjack
  - CocoaLumberjack (3.7.1):
    - CocoaLumberjack/Core (= 3.7.1)
  - CocoaLumberjack/Core (3.7.1)
    - CocoaLumberjack (~> 3.7.0)
    - CocoaLumberjack
  CocoaLumberjack: 7776c302e2e78298fc28738d6a0e3df1bfca68b6
(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % cat package.json |grep geolocation
    "react-native-background-geolocation-android": "git+https://ASecretWasHere:[email protected]/transistorsoft/react-native-background-geolocation-android.git#4.0.3",
(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % cat yarn.lock |grep geolocation
"react-native-background-geolocation-android@git+https://ASecretWasHere:[email protected]/transistorsoft/react-native-background-geolocation-android.git#4.0.3":
  resolved "git+https://ASecretWasHere:[email protected]/transistorsoft/react-native-background-geolocation-android.git#ac9bcf597837bd2c9dd08716f5f4013669c4ebca"
(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % xcodebuild -version
Xcode 12.4
Build version 12D4e

two machines with errors like this, both macOS 11.2.3 (20D91)

I never mind company in a hot pursuit, but I'm pursuing this one currently myself as I was hoping to do a new TestFlight build of my app today...

It seems [email protected] deprecated a _tag property that I'm using, but what they really meant was they removed it.

TSLocationManager's Podfile.lock was pinned at [email protected]. Doing a pod update CocoaLumberjack, now I see the error in TSLocationManager src. That's a crappy thing to throw down into a point-release.

I checked the intermediate library file with lipo and it was definitely for my intended architecture despite receiving this error

I used strings against and ... that symbol is missing

(base) mike@kunashir:~/work/Kullki/ksocialscore/packages/public-app (p2p-features *) % strings /Users/mike/Library/Developer/Xcode/DerivedData//Komp.ai-ajpdygwoibldjgggzzmhkvrmqvmz/Build/Products/Debug-iphonesimulator/CocoaLumberjack/libCocoaLumberjack.a|grep DDLogMessage
_OBJC_CLASS_$_DDLogMessage
_OBJC_IVAR_$_DDLogMessage._context
_OBJC_IVAR_$_DDLogMessage._file
_OBJC_IVAR_$_DDLogMessage._fileName
_OBJC_IVAR_$_DDLogMessage._flag
_OBJC_IVAR_$_DDLogMessage._function
_OBJC_IVAR_$_DDLogMessage._level
_OBJC_IVAR_$_DDLogMessage._line
_OBJC_IVAR_$_DDLogMessage._message
_OBJC_IVAR_$_DDLogMessage._options
_OBJC_IVAR_$_DDLogMessage._qos
_OBJC_IVAR_$_DDLogMessage._queueLabel
_OBJC_IVAR_$_DDLogMessage._representedObject
_OBJC_IVAR_$_DDLogMessage._threadID
_OBJC_IVAR_$_DDLogMessage._threadName
_OBJC_IVAR_$_DDLogMessage._timestamp

They broke some other backwards compatible thing from 3.6 to 3.7 also, they are not semver safe.

So, pin it to 3.7.0 for now? What fun :-)

3.7.1 was released yesterday. I think we pin to 3.7.0 for now.

yeah, I use myself as a crash test dummy with a sort of daily update to see what bitrot (and fun) happened with updates overnight, in order to catch the falling knives before the users file bug reports in react-native-firebase etc, so makes sense I would see this immediately. Unfortunate it bit @WaseemAhmed645 and @ziyaddin as well.

The change was actually from October, just appears they were slow to release it. I commented here:
https://github.com/CocoaLumberjack/CocoaLumberjack/pull/1177#issuecomment-816273495

Pinning the dependency in my Podfile works, via this line, and I guess you just have to kill the tilde in the podspec for the dep here as they're not semver safe?

  pod 'CocoaLumberjack', '3.7.0'

Can somebody try installing branch #release-4.0.4?

I'll give it a go yeah

wait - from this repo or private repo? We're working this on the public repo but I actually the private one normally.

private.

that git ref yarn installs correctly, pod installs as '4.0.4', I removed my CocoaLumberjack version pin from above prior and then did a pod outdated and it correctly showed 3.7.1 of CocaLumberjack was available but not accessible due to version restrictions from the Podfile (oh and it builds of course, that's important...)

Just to make sure I deleted Podfile.lock, re-did pod install and still got CocoaLumberjack 3.7.0, with the Podfile.lock expressing the specific 3.7.0 version as dependent from here

Looks all good

@WaseemAhmed645, @ziyaddin [email protected] is released to npm with CocoaLumberjack pinned @ 3.7.0

My release build with same just finished archiving right now and is uploading to TestFlight, back in business!

@WaseemAhmed645, @ziyaddin [email protected] is released to npm with CocoaLumberjack pinned @ 3.7.0

show me this npm ERR! notarget No matching version found for [email protected]

@mikehardy
@christocracy
kindly guide me on ios side where we place our lience key of background-geolocation
In React Native

show me this npm ERR! notarget No matching version found for [email protected]

@WaseemAhmed645 It seems that version 4.0.3 has not yet been published. I temporarily went with the alternative method specified by Mike Hardy:

Pinning the dependency in my Podfile works, via this line, and I guess you just have to kill the tilde in the podspec for the dep here as they're not semver safe?

pod 'CocoaLumberjack', '3.7.0'

This method is successful.

Kindly guide me on iOS side where we place our license key of background-geolocation in React Native

@WaseemAhmed645 License key is needed only for Android, not iOS.

I made contact with the author of CocoaLumberjack. He has released 3.7.2, re-introducing the removed _tag property.

And oops: I left my npm publish hanging last night waiting for me to enter the OTP Code.

4.0.3 was published just now to npm.

Was this page helpful?
0 / 5 - 0 ratings