React-native: Linker clash with GVRSDK (vlog_is_on.o)

Created on 19 Feb 2018  路  13Comments  路  Source: facebook/react-native

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 7.9.0
Yarn: 0.23.2
npm: 4.2.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.53.0 => 0.53.0

Steps to Reproduce

1) Initialize a react-native project with react-native init
2) Initialize cocoapods and add "pod 'GVRSDK'" to the pod file, run pod install
3) open workspace, run project in xcode or via react-native run-ios

Expected Behavior

Run without linker error

Actual Behavior

Fails to link with the following error:

duplicate symbol __ZN3fLI9FLAGS_novE in:
 /test_proj/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on_8d2e7d29c7bb2e5dfa3670dcea4320a0.o)
    /Library/Developer/Xcode/DerivedData/test_proj-btwdvvwnrjygbfeqvozqudjeesra/Build/Products/Debug-iphoneos/libReact.a(vlog_is_on.o)
duplicate symbol __ZN3fLI7FLAGS_vE in:
    /test_proj/ios/Pods/GVRSDK/Libraries/libGVRSDK.a(vlog_is_on_8d2e7d29c7bb2e5dfa3670dcea4320a0.o)
    /Library/Developer/Xcode/DerivedData/test_proj-btwdvvwnrjygbfeqvozqudjeesra/Build/Products/Debug-iphoneos/libReact.a(vlog_is_on.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reproducible Demo

https://github.com/shauntc/ReactNativeGVRSDKLinkerFailure
run 'pod install' in ios/ to install cocoapods

iOS Stale

Most helpful comment

@Tankerxyz

Our temporary fix for this is to remove it from the GVRSDK lib using this shell script:

#!/bin/bash

cd ./Pods/GVRSDK/Libraries/
lipo -info libGVRSDK.a

architectures="armv7 i386 x86_64 arm64"
for arch in $architectures
do
    echo Create thin archive libGVRSDK_$arch
    lipo -thin $arch libGVRSDK.a -output libGVRSDK_$arch
    chmod 777 libGVRSDK_$arch

    remove=""
    for object in $(ar -t libGVRSDK_$arch)
    do
        if [[ ${object} == vlog_is_on_* ]]
        then
            echo $object
            remove=$object
        fi
    done

    if [ $remove ]
    then
        echo removing $remove from $arch
        ar -dv libGVRSDK_$arch $remove
    else
        echo No symbol matching "vlog_is_on_*" found for $arch
    fi

done

echo Rebuild libGVRSDK.a
lipo -create libGVRSDK_armv7 libGVRSDK_i386 libGVRSDK_x86_64 libGVRSDK_arm64 -output libGVRSDK.a

for arch in $architectures
do
    rm libGVRSDK_$arch
    echo Delete thin archive libGVRSDK_$arch
done

cd ../../../

Adding this to the end of our podfile to run it after each time we run pod install:

# Hack to fix linker error between GVRSDK and React
post_install do |installer|
    system(". ./pod_post_install.sh")
end

(the script is saved in the same directory as the podfile as "pod_post_install.sh")

All 13 comments

+1

@Tankerxyz

Our temporary fix for this is to remove it from the GVRSDK lib using this shell script:

#!/bin/bash

cd ./Pods/GVRSDK/Libraries/
lipo -info libGVRSDK.a

architectures="armv7 i386 x86_64 arm64"
for arch in $architectures
do
    echo Create thin archive libGVRSDK_$arch
    lipo -thin $arch libGVRSDK.a -output libGVRSDK_$arch
    chmod 777 libGVRSDK_$arch

    remove=""
    for object in $(ar -t libGVRSDK_$arch)
    do
        if [[ ${object} == vlog_is_on_* ]]
        then
            echo $object
            remove=$object
        fi
    done

    if [ $remove ]
    then
        echo removing $remove from $arch
        ar -dv libGVRSDK_$arch $remove
    else
        echo No symbol matching "vlog_is_on_*" found for $arch
    fi

done

echo Rebuild libGVRSDK.a
lipo -create libGVRSDK_armv7 libGVRSDK_i386 libGVRSDK_x86_64 libGVRSDK_arm64 -output libGVRSDK.a

for arch in $architectures
do
    rm libGVRSDK_$arch
    echo Delete thin archive libGVRSDK_$arch
done

cd ../../../

Adding this to the end of our podfile to run it after each time we run pod install:

# Hack to fix linker error between GVRSDK and React
post_install do |installer|
    system(". ./pod_post_install.sh")
end

(the script is saved in the same directory as the podfile as "pod_post_install.sh")

@shauntc thanks, it works for me.

I have followed the guide, but it generates this error when running.
screen shot 2018-05-11 at 11 25 12 am

@ttDemon Need some more context here:
What versions of react/gvrsdk are you running?
What symbols were clashing before?
What does your post install script look like?


"react": "16.3.0-alpha.1",
"react-native": "0.54.3",

"GVRSDK": "1.140.0",

symbols were clashing before:

screen shot 2018-05-10 at 10 37 05 am


my post install script:

!/bin/bash

cd ./Pods/GVRSDK/Libraries/
lipo -info libGVRSDK.a

architectures="armv7 i386 x86_64 arm64"
for arch in $architectures
do
echo Create thin archive libGVRSDK_$arch
lipo -thin $arch libGVRSDK.a -output libGVRSDK_$arch
chmod 777 libGVRSDK_$arch

remove=""
for object in $(ar -t libGVRSDK_$arch)
do
    if [[ ${object} == vlog_is_on_* ]]
    then
        echo $object
        remove=$object
    fi
done

if [ $remove ]
then
    echo removing $remove from $arch
    ar -dv libGVRSDK_$arch $remove
else
    echo No symbol matching "vlog_is_on_*" found for $arch
fi

done

echo Rebuild libGVRSDK.a
lipo -create libGVRSDK_armv7 libGVRSDK_i386 libGVRSDK_x86_64 libGVRSDK_arm64 -output libGVRSDK.a

for arch in $architectures
do
rm libGVRSDK_$arch
echo Delete thin archive libGVRSDK_$arch
done

cd ../../../


@shauntc If I do not add post install script then I run release mod ok, but debug will report duplicate error as above image

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

This problem still occurs.

React-Native v0.55.4
Xcode 9.3.1
GVRSDK 1.140.0

@react-native-bot ping

I am having the same issue as @ttDemon.
Any solution up until now?
I'm running
RN 0.56.0
XCode 9.1
GVRSDK 1.140.0

I am getting the same issue as @ttDemon and @fabianlee1211.
RN 0.56.0
XCode 9.2
GVRSDK 1.140.0

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings