DeepARSDK / quickstart-ios-swift

DeepAR SDK for iOS example project
https://developer.deepar.ai
MIT License
23 stars 9 forks source link

building to simulator - ld: symbol(s) not found for architecture x86_64 #3

Closed 8secz-johndpope closed 7 months ago

8secz-johndpope commented 4 years ago

arm64 Undefined symbols for architecture x86_64: "_OBJCCLASS$_ARView", referenced from: objc-class-ref in ARViewController.o (maybe you meant: _OBJCCLASS$_ARViewController) ld: symbol(s) not found for architecture x86_64

I ripped out the production sdk and threw in the simulator sdk

I'm not clear how to use together - sometimes I need to build to device right now I need to build to simulator for other things...

Screen Shot 2020-01-13 at 2 33 31 pm

are there some settings to check? above it seems embed frameworks uses sim folder link with uses the link library....

hdNguyenPTR commented 4 years ago

same problem -

ld: warning: ignoring file /Users/matt/Documents/gitWorkspace/8secondz-ios/8secondz/External/DeepAR.framework/DeepAR, building for iOS Simulator-x86_64 but attempting to link with file built for iOS-arm64 Undefined symbols for architecture x86_64:

8secz-johndpope commented 4 years ago

I'm sure it's possible to combine the two frameworks together - not sure how though. If not - it's fine I can work around it - instructions aren't clear though.

It seems that the two frameworks included ( one for hardware / one for simulator ) can not / or should not be both imported - ie - if you're building to simulator - use simulator framework / if your building to device rip out simulator and use device framework - which is what I mostly use so not a problem - but need to test something with ios13.

Screen Shot 2020-01-20 at 11 44 32 am
8secz-johndpope commented 4 years ago
Screen Shot 2020-01-29 at 9 59 19 am

so dropping in the simulator frameworks works a treat for dev / both on device + simulator - but not appropriate for app store. can get around it by creating a new schema target. developement prod

8secz-johndpope commented 4 years ago

distantly related - (actually didn't work so well) https://gist.github.com/kenthumphries/cf04683184217c7331f9c213c556c65a https://stackoverflow.com/questions/40400086/xcode-add-embedded-binary-with-buildscript/40484337#40484337

this code successfully signs and includes only for debug builds / framework is weakly linked - it's an awesome pod - worth having a look. https://raw.githubusercontent.com/CocoaDebug/CocoaDebug/master/CocoaDebug/copy_and_codesign.sh

basically - the answer to this problem don't include both frameworks / make them weakly linked - then at run time - in build script - determine what to include copy and codesign. I'll take another look when I have more bandwidth.

mauker commented 3 years ago

I believe I went through a few steps in the right direction but even though I managed to select the right frameworks between simulator and production I still have the error

echo "START EMBED DEEP_AR LIB"

MY_PLATFORM_NAME=$PLATFORM_NAME
IS_SIMULATOR="iphonesimulator"

#SELECT THE CORRECT FRAMEWORK BUILT BY SIMULATOR OR NOT
if [ "$MY_PLATFORM_NAME" = "$IS_SIMULATOR" ]; then
        echo 'DEVICE SIMULADOR'
        #ADDRESS OF SIMULATOR FRAMWORK
        FRAME_WORK_CORRECT="track_white_label/Support/NotEmbedLibs/simulator/DeepAR.framework"
else
        echo 'DEVICE REAL'
        #ADDRESS OF OS FRAMWORK
        FRAME_WORK_CORRECT="track_white_label/Support/NotEmbedLibs/release/DeepAR.framework"
fi

#CREATE FOLDER TO PUT THE .framework that will be used by the application
Folder_To=$BUILT_PRODUCTS_DIR"/"$PRODUCT_NAME".app/Frameworks/DeepAR.framework/"
echo "Where to copy =>"$Folder_To
#CREATE ADRESS FROM
Folder_From=$PROJECT_DIR"/"$FRAME_WORK_CORRECT
echo "Where from copy =>"$Folder_From

#CREATE FOLDER TO PUT THE .framework that will be used by the application
mkdir -p $BUILT_PRODUCTS_DIR"/"$PRODUCT_NAME".app/Frameworks"
#COPY FILES, to aplications with space in name is needed to use an extra "" like "$Folder_To
cp -Rv $Folder_From "$Folder_To"

#GET THE IDENTTY TO SIGN
CODE_SIGN_IDENTITY_FOR_ITEMS="${EXPANDED_CODE_SIGN_IDENTITY_NAME}"

if [ "${CODE_SIGN_IDENTITY_FOR_ITEMS}" = "" ] ; then
    CODE_SIGN_IDENTITY_FOR_ITEMS="${CODE_SIGN_IDENTITY}"
fi

#CREATE A METHOD TO ASIGN
codesign_library() {
  if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" ]; then
    codesign -fs "${EXPANDED_CODE_SIGN_IDENTITY}" "$Folder_To"
  fi
}    

#ASSIGN IF NECESSARY
if [ "$MY_PLATFORM_NAME" != "$IS_SIMULATOR" ]; then
    codesign_library
fi

echo "FINISH EMBED DEEP_AR LIB"
JelenaKB commented 3 years ago

If you need simulator and production SDKs in the same project you could create two separate targets for them.

Screen Shot 2021-03-15 at 18 54 36

Then you can add the frameworks only to the target that uses them and set up embedding as needed.