简体   繁体   中英

Why do I get this error when compiling a LiveCode iOS external for device but it compiles fine for the simulator?

Here's the error:

Undefined symbols for architecture armv7:
  "___udivmodsi4", referenced from:
      _sqlite3BitvecSet in libmergDropboxSync.a(sqlite3.o)
      _sqlite3BitvecClear in libmergDropboxSync.a(sqlite3.o)
      _sqlite3BitvecTest in libmergDropboxSync.a(sqlite3.o)
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/np/1scdfrdd7kx64bbykn22wj200000gn/T//ccvBM79H.out (No such file or directory)
error: linking step of external dylib build failed, probably due to missing framework or library references - check the contents of the mergDropboxSync.ios file
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure

When I build for the simulator it builds fine. My library is compiling fine. It's only at the linking stage for the dylib that is documented in lclink.sh as only for a dependency check for device builds that there's an issue:

# Build the 'dylib' form of the external - this is used by simulator builds, and as
# a dependency check for device builds.
"$PLATFORM_DEVELOPER_BIN_DIR/g++" -dynamiclib $ARCHS -isysroot "$SDKROOT" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" $SYMBOL_ARGS $SYMBOLS $DEPS
if [ $? != 0 ]; then
    echo "error: linking step of external dylib build failed, probably due to missing framework or library references - check the contents of the $PRODUCT_NAME.ios file"
    exit $?
fi

I tried skipping this step using the following:

if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then
    # Build the 'dylib' form of the external - this is used by simulator builds, and as
    # a dependency check for device builds.
    "$PLATFORM_DEVELOPER_BIN_DIR/g++" -dynamiclib $ARCHS -isysroot "$SDKROOT" -o "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME" $SYMBOL_ARGS $SYMBOLS $DEPS
    if [ $? != 0 ]; then
        echo "error: linking step of external dylib build failed, probably due to missing framework or library references - check the contents of the $PRODUCT_NAME.ios file"
        exit $?
    fi
fi

This allowed the script to continue on and build the object files for static linking in the device builds. They built fine but then when I went to build the standalone the dependency check blocked it. Is there any workaround anyone can recommend?

Note that I use a slightly modified lclink.sh which adds weak linking support and optional framework inclusion depending on the SDK you're building against. It can be found here if that helps: http://repo.goulding.ws/livecodeiossdk/src/b570507fe48274cc4c0f90102809194eafe5225d/lclink.sh?at=master


EDIT

Given that the error was clearly armv7 related I tried a build against armv7s and it builds fine. I'm coming to the conclusion that the the new dropbox sync sdk may have some armv7s only code. It appears to be sqlite related based on the error. Not sure what else to try at this stage...


EDIT

It appears to be a toolchain issue caused by the Dropbox sync api being compiled with Apple LLVM and LiveCode externals and device builds being compiled with Apple GCC.

Does this help any? I wrote this up when I was having a somewhat similar problem.

runrev lesson on linking to a dylib library

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM