0
votes

I encounter a problem that i try my best to resolve it, but i spend so much time it not working for me.

I don't have any idea to fix it. My project build on Xcode 9.1, libnama.a library is in a thirdParty for my project,called Faceunity, .a library added my project, Other Linker Flags i have added $(inherited)

Architectures set armv7 armv7s arm64 x86_64, used some other people's methods it always not ok!!!! I hope that if anyone have any idea maybe to fix please tell me, thanks!

Error:

Undefined symbols for architecture arm64: "_cblas_sgemm", referenced from: _cnn_run in libnama.a(cnn-arm64.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Other info:

enter image description here

2
Hi @nickpan, maybe you resolved it? I'm facing the same issue.thy.nguyen

2 Answers

0
votes

This is a typical error when we integrate third-party libraries in our applications. It is saying that the required library has not built for arm64 architecture.

The linker couldn't able to find the symbols for arm64 in the specified static library. To check the supported architectures for static library use lipo or file

lipo -info libGoogleAnalytics.a .
Architectures in the fat file:libGoogleAnalytics.a are: armv7 i386 x86_64 arm64

0
votes

It is because some third party library includes support simulators. But while building the application you have to exclude the support to the architecture support for simulators

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done