xcode5 - Xcode - symbol(s) not found for architecture x86_64 (iOS Lib) -
i building static library. build setting has architectures set to: $(archs_standard) shown standard architectures (armv7, armv7s, arm64) build lib choosing ios device , using simulator (for illustration iphone retina).
now have 2 builds (one within debug-iphoneos , other within debug-iphonesimulator, utilize lipo -create create aggregated lib:
lipo -create path/to/first/lib /path/to/second/lib -o mylib.a if used library in project simulate on ios device 64-bit architecture, gives symbol(s) not found architecture x86_64. makes me angry lib project within workspace project utilize lib. can simulate on 64-bit ios simulator! (on simulators , devices matter). doing wrong?
notes:
this not duplicate q. before accusing me of (since sec day trying prepare stupid issue), did search on stack , google. answers don't help. i using xcode 5.1.1.
i had same problem building static library. have found basic solution. (you need build universal library x86_64/armv7/armv7s/arm64)
1) click on project file 2) click on target 3) open "build phases" 4) open "run script" 5) add together "/bin/sh" , script below
########################################## # # c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 # # version 2.7 # # latest change: # - supports iphone 5 / ipod touch 5 (uses apple's workaround lipo bug) # # purpose: # automatically create universal static library iphone + ipad + iphone simulator within xcode # # author: adam martin - http://twitter.com/redglassesapps # based on: original script eonil (main changes: eonil's script not work in xcode gui - crash computer) # set -e set -o pipefail #################[ tests: helps workaround future bugs in xcode ]######## # debug_this_script="false" if [ $debug_this_script = "true" ] echo "########### tests #############" echo "use next variables when debugging script; note may alter on recursions" echo "build_dir = $build_dir" echo "build_root = $build_root" echo "configuration_build_dir = $configuration_build_dir" echo "built_products_dir = $built_products_dir" echo "configuration_temp_dir = $configuration_temp_dir" echo "target_build_dir = $target_build_dir" fi #####################[ part 1 ]################## # first, work out basesdk version number (nb: apple ought study this, hide it) # (incidental: searching substrings in sh nightmare! sob) sdk_version=$(echo ${sdk_name} | grep -o '.\{3\}$') # next, work out if we're in sim or device if [ ${platform_name} = "iphonesimulator" ] other_sdk_to_build=iphoneos${sdk_version} else other_sdk_to_build=iphonesimulator${sdk_version} fi echo "xcode has selected sdk: ${platform_name} version: ${sdk_version} (although back-targetting: ${iphoneos_deployment_target})" echo "...therefore, other_sdk_to_build = ${other_sdk_to_build}" # #####################[ end of part 1 ]################## #####################[ part 2 ]################## # # if original invocation, invoke whatever other builds required # # xcode building 1 target... # # ...but library, apple wrong set build one. # ...we need build targets # ...we must not re-build target beingness built: xcode crash computer if seek (infinite recursion!) # # # so: build missing platforms/configurations. if [ "true" == ${alreadyinvoked:-false} ] echo "recursion: not root invocation, i'm not going recurse" else # critical: # prevent infinite recursion (xcode sucks) export alreadyinvoked="true" echo "recursion: root ... recursing missing build targets now..." echo "recursion: ...about invoke: xcodebuild -configuration \"${configuration}\" -project \"${project_name}.xcodeproj\" -target \"${target_name}\" -sdk \"${other_sdk_to_build}\" ${action} run_clang_static_analyzer=no" build_dir=\"${build_dir}\" build_root=\"${build_root}\" symroot=\"${symroot}\" xcodebuild -configuration "${configuration}" -project "${project_name}.xcodeproj" -target "${target_name}" -sdk "${other_sdk_to_build}" ${action} run_clang_static_analyzer=no build_dir="${build_dir}" build_root="${build_root}" symroot="${symroot}" action="build" #merge platform binaries fat binary each configurations. # calculate (multiple) built files coming from: currentconfig_device_dir=${symroot}/${configuration}-iphoneos currentconfig_simulator_dir=${symroot}/${configuration}-iphonesimulator echo "taking device build from: ${currentconfig_device_dir}" echo "taking simulator build from: ${currentconfig_simulator_dir}" creating_universal_dir=${symroot}/${configuration}-universal echo "...i output universal build to: ${creating_universal_dir}" # ... remove products of previous runs of script # nb: directory created script - should safe delete! rm -rf "${creating_universal_dir}" mkdir "${creating_universal_dir}" # echo "lipo: current configuration (${configuration}) creating output file: ${creating_universal_dir}/${executable_name}" xcrun -sdk iphoneos lipo -create -output "${creating_universal_dir}/${executable_name}" "${currentconfig_device_dir}/${executable_name}" "${currentconfig_simulator_dir}/${executable_name}" ######### # # added: stackoverflow suggestion re-create "include" files # (untested, should work ok) # echo "fetching headers ${public_headers_folder_path}" echo " (if embed library project in project, need add" echo " "user search headers" build setting of: (nb include double quotes below!)" echo ' "$(target_build_dir)/usr/local/include/"' if [ -d "${currentconfig_device_dir}${public_headers_folder_path}" ] mkdir -p "${creating_universal_dir}${public_headers_folder_path}" # * needs outside double quotes? cp -r "${currentconfig_device_dir}${public_headers_folder_path}"* "${creating_universal_dir}${public_headers_folder_path}" fi fi
6) nail "cmd + b" (build project)
7) open product in finder
8) navigate 1 directory ("cmd + ↑"), , see "release-universal" directory.
there "fat/universal" library, ready go!
ios xcode5 64bit static-libraries
No comments:
Post a Comment