I am getting this error and can't map file list file - ios

I am getting this error and don't know what is the issue at all Its suddenly started to coming up for all my projects when I compile it.
/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
can't map file list file: /Users/aravindsekar/Desktop/Office/newPad/
(Invalid argument)
Its happen when I start to add pods in my project.
Note: I checked same kind of issue and its not helping me. All my Target binaries are in active state and there is no issue there. Cleaned. Did Project clean as well.
In fact this is the complete error for one of the project
Libtool /Users/aravindsekar/Downloads/ElasticTransition-master/,/ElasticTransitionExample/Build/Products/Debug-iphonesimulator/Pods.framework/Pods normal x86_64
cd /Users/aravindsekar/Downloads/ElasticTransition-master/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -L/Users/aravindsekar/Downloads/ElasticTransition-master/,/ElasticTransitionExample/Build/Products/Debug-iphonesimulator -filelist /Users/aravindsekar/Downloads/ElasticTransition-master/,/ElasticTransitionExample/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods.build/Objects-normal/x86_64/Pods.LinkFileList -framework Foundation -o /Users/aravindsekar/Downloads/ElasticTransition-master/,/ElasticTransitionExample/Build/Products/Debug-iphonesimulator/Pods.framework/Pods

Check if your Folder it is trying to create has space or special characters. I got this error when I was building Ionic app for iOS. It worked fine till the name tag in my config.xml did not have a coma character. Just to be doubly sure give it a one word name and then restart the build for ios.
cordova platform rm ios
cordova platform add ios
ionic cordova prepare ios
then build using xcode .
To open the project in Xcode you need to look for .xcodeproj. For ionic project it is in platforms > ios
Now click on the build icon, or from the Menu Product > Build

Related

Xcode project giving pod file error for FIRAnalyticsConnector.framework . How to solve it?

I'm working on a book project and the project is connected by API . I'm working on the book app which has different libraries imported from the various places.
Recently, i cloned the project from bitbucket in Xcode and tried to run it. The result i got i error as follows:
enter image description here
It shows :
ld: in /Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Help needed to fix the error, as the project has lots of mixes of old libraries along with .h and .m files, the swift files with wireframes
According to the image I saw that you are trying run the app on the iOS simulator, then you could try to add the arm64 to the Excluded Architectures on the Build Settings section of your project or target, it would be like:
Take in mind that if you use Cocoa Pods is possible that also you should add the arm64 to the Exclude Architectures into the Pods project
After the above, clean, build and run the project on the iOS simulator, is possible that on your physical device you must remove the arm64 from the Exclude Architectures, it could depend on what you use in your project.
On the other hand, you can try the following: Select the project -> Select the target -> Go to the Build Phases -> Expand the Link Binary with libraries and add all pod libraries (remove if they exist in embedded binaries or Remove the old FrameWorks), after that, clean and build the project

Failed to verify bitcode while exporting archive for ad hoc distribution - tried Xcode 8.3.3 & Xcode 9

Apps containing our framework complains about missing bitcode while exporting archive for Ad-hoc distribution.
I have gone through the documentation provided by Apple in this regard
Technical Note TN2432. The documentations' listed possible root causes do not resemble our scenario. (We are not using assembly instructions or have malformed info.plist file)
I have gone through following similar questions posted on SO
Error while exporting with Bitcode enabled (symbol not found for architecture armv7)
Is it possible to create a universal iOS framework using bitcode?
New warnings in iOS 9
But the provided solutions do not seem to work.
I have tried adding BITCODE_GENERATION_MODE flag in User-Defined build settings. I also tried adding -fembed-bitcode-marker & -fembed-bitcode in Other C flags in framework target.
I check if bitcode segments are present in my generated framework using the suggested command
otool -l -arch arm64 <framework_name> | grep __LLVM
It shows 2 segments
segname __LLVM
segname __LLVM
But while exporting the archive, Xcode still complains about absent bitcode.
I tried to upload app on App store to verify if this issue is due to Xcode versions (I tried 8.3.3. and 9.0), but I get following email about build import error from iTunes Store.
While processing your iOS app, APP_NAME 1.0(4), errors occurred in the app thinning process, and your app couldn’t be thinned. If your app contains bitcode, bitcode processing may have failed. Because of these errors, this build of your app will not be able to be submitted for review or placed on the App Store. For information that may help resolve this issue, see Tech Note 2432.
PS: Disabling bitcode is not an option for us as host app need to support bitcode.
The error description took me in the wrong direction to find the solution.
This error is not related to bitcode.
It appeared when the framework contained simulator slices (i386 x86_64)
Removing them before archiving resolved the issue.
Adding a run script phase to build phases of the target with following code helped in getting rid of the error.
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
Credits: http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/
If you don't know how to add a run script phase to your Xcode project, because maybe you're building a project with Cordova or Ionic and you never were taught much about Xcode, here's how you do that:
Open your project in Xcode.
Make sure you're looking at your project in the "Project Navigator" by clicking on the left-most icon in the left pane of Xcode (the one that says "show Project Navigator" when you point at it.
Click on your project at the top of the navigator window, so that it is selected as your target
At that point, in the middle portion of the Xcode window, you'll see several things appear near the top. General, Capabilities, Resource Tags, Info, among others. One of them is Build Phases -- click on it.
Click the + that's near the top-left of the middle portion of the Xcode Window. It will say Add New Build Phase if you point at it long enough.
Select "New Run Script Phase" from the menu that popped up when you clicked on the +
Click on the arrow next to the Run Script that just appeared.
Copy and paste the above script into the appropriate area just below the word "Shell". You shouldn't have to change anything else.
Build/Archive your project like normal, only now you won't get those annoying "failed to verify bitcode" errors. :-)
I had to set Enable Bitcode to 'NO' in Build Settings
Try the following:
Make sure this framework is added under Copy Frameworks Script in Build Phases.
Use BITCODE_GENERATION_MODE instead of BITCODE_GENERATION_CODE
I was facing the same issue. But in my case, I found out after one day of struggle that my system was running out of memory. As soon as I created some space in the system all worked fine.

how to build DLIB for iOS

I'm trying to build DLIB for an iOS project. Running the cmake results in a libdlib.a and a load of .o files.
When I add the library to an Xcode project I get warning that the library hasn't been built for arm64.
My question is two-part:
How can I build DLIB for iOS (I tried cmake **path_to_source** -DCMAKE_OSX_ARCHITECTURE="arm64" but it caused loads of errors e.g. unknown type name '__uint32_t'; did you mean '__uint128_t')?
What is the purpose of all the .o files that get built when you run cmake? Do I need to include them in an Xcode project?
I finally figured out how to do this:
Requirements
X11 (on a mac you can just open the X11 app and if X11 isn't installed it'll take you to the download).
Xcode
cmake (you can use home-brew for that)
Steps
In terminal make the lib-xx.xx/examples your root
Run:
mkdir build
cd build
cmake -G Xcode ..
cmake --build . --config Release
This will create a folder called dlib_build in which you can find an Xcode project that compiles the library. In the build settings of that Xcode project you can set the build architecture and SDK for any Xcode supported OS you like!
EDIT:
You have to include a lot of custom compiler flags and 3rd party libraries to get dlib to work in a project. Check out the examples.xcproject build settings.
To compliment RASS's answer, I am attaching screenshots showing how to change this to and from an iOS and OSX lib
After opening the project,
Select the project file from the project navigator
Select the dlib target all the way down the bottom
Select 'Build Settings'
Expand 'Base SDK' drop down
Select either iOS or macOS (OSX)
I hope this helps some people out! gl
Rob Sanders and mylogon already show how to build dlib for ios, here is how to use it:
add libdlib.a to project, and add path to library search paths
add all source to include directory(do not add to project), and add path to header search paths.
add accelerate framework, which contains blas symbols.
add preprocessor macros, from building settings, "custom compiler flag"/"other c flags". these macros make sure the header files match the lib.
-DDLIB_JPEG_SUPPORT
-DDLIB_NO_GUI_SUPPORT
-DNDEBUG
-DDLIB_USE_BLAS
-DDLIB_USE_LAPACK

Cocoa Touch Framework fails to debug on simulator in embedding project

I've got a Cocoa Touch framework built with XCode 6 targetted towards iOS >= iOS8.
This framework's target architecture settings are default, meaning that I haven't changed anything.
The architectures are set to standard (which doesn't include x86_64, more on that later).
The framework itself contains both Swift and Objective-C code, so building it using the static library workaround from Ray Wenderlich won't work.
Now, if I create a new project and add the framework project to it, the project builds for both the device and simulator, which is fine.
However, if I take the .framework file and add it to a different project just like you'd add any other framework, the project won't build for the simulator. Well, it does build, but it crashes because it can't find the relevant classes. It works fine on the device and archiving works just as expected as well.
The framework project itself already gives me a warning;
"Apple Mach-O Linker Warning - Directory not found for option ....(Debug-ophoneos)".
Any help would be highly appreciated!
I have finally found the solution to this issue.
As it turns out, XCode no longer creates fat binaries out of the box. No idea what Apple's reasoning behind this might be, too me it just seems like sometimes the guys responsible for XCode like to make fun of the developers using their product...
Anyways, you can find the definitive guide as to how to create a fat binary for simulator and all iOS devices (yes, you even have to lipo different architectures in order to get a framework that works on newer and older devices): https://kodmunki.wordpress.com/2015/03/04/cocoa-touch-frameworks-for-ios8-remix/
In short;
Create a Cocoa Touch Framework
Set the Architectures to arm64, armv7, and armv7s
Set "Build Active Architecture" to "NO"
Set "Valid Architectures" to arm64, armv1, and armv7s
Add the following script to the framework's build Scheme as an Archive Post-action;
set -e
DEVICE_BIN="${OBJROOT}/UninstalledProducts/${TARGET_NAME}.framework"
SIMULATOR_BIN="${SYMROOT}/../../../../Products/Debug- iphonesimulator/${TARGET_NAME}.framework"
ARCHIVE_PATH="${SRCROOT}/_Archive"
rm -rf "${ARCHIVE_PATH}"
mkdir "${ARCHIVE_PATH}"
if [ "${CONFIGURATION}" = "Release" ]; then
if [ -d "${DEVICE_BIN}" ]; then
DEVICE_PATH="${ARCHIVE_PATH}/Release"
mkdir "${DEVICE_PATH}"
cp -r "${DEVICE_BIN}" "${DEVICE_PATH}"
fi
if [ -d "${SIMULATOR_BIN}" ]; then
SIMULATOR_PATH="${ARCHIVE_PATH}/Debug"
mkdir "${SIMULATOR_PATH}"
cp -r "${DEVICE_BIN}" "${SIMULATOR_PATH}"
lipo -create "${DEVICE_BIN}/${TARGET_NAME}" "${SIMULATOR_BIN}/${TARGET_NAME}" -output "${SIMULATOR_PATH}/${TARGET_NAME}.framework/${TARGET_NAME}"
fi
fi
exit 0;
This will create an _Archive directory in your project's directory where you can find the frameworks for both debug and release.
Important: As of today (May 22nd 2015) you'll have to build the project with the simulator first, and then archive with a device. Otherwise you won't get a universal binary!
This post has been created in order to avoid dead link errors, for updates regarding the packaging process, please ALWAYS try the steps posted on the kodmunki website I've linked above first as the steps in this post might have been outdated already!

Linker errors after upgrading Xcode to 4.5.2 and OpenCV to 2.4.3

My project was working just fine until this morning. I was using xcode 4.3, and an older version of OpenCV (I'm not sure about the exact version). OSX was already 10.7.x, but not 10.7.5
Today, after upgrading OSX to 10.7.5, xcode to 4.5.2, and downloading OpenCV 2.4.3, I am getting the following linker errors when trying to build the project:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in opencv2(cap_ios_video_camera.o)
"cv::FeatureDetector::create(std::string const&)", referenced from:
-[ImageAnalyzer detectBlobs:] in ImageAnalyzer.o
"cv::FeatureDetector::detect(cv::Mat const&, std::vector >&, cv::Mat const&) const", referenced from:
-[ImageAnalyzer detectBlobs:] in ImageAnalyzer.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In order to use the new opencv framework I removed the reference to the old framework, and referenced the project to the official prebuilt opencv2.framework downloaded from here.
I also removed the reference to libz.dylib, and added a reference to libc++.dylib instead.
Last step was to update the prefix file to the new framework. The relevant part in the prefix file now looks like this:
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
It all narrowed down to these 4 linker errors I can't seem to get rid of. I tried using libstdc++.dylib, but I am getting even more errors. I also tried building OpenCV myself as explained here, but I am still getting the same errors as the prebuilt framework.
What did I miss? Is there anything else I need to change in my project?
UPDATE:
As seen here, setting the "C++ Standard Library" to "libc++ (LLVM C++ standard libray with C++ 11 support" yielded only one error:
clang: error: invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later)
Changing the deployment target to iOS 5 finally got my project to run again.
Does this mean OpenCV 2.4.3 doesn't work on iOS versions older than 5?
steps to compile and run c++ opencv 2.4.4 on mac os x lion 10.7.5 with cmake 2.8.10 and xcode 4.6.1
Having the right tools
download opencv-unix from http://sourceforge.net/projects/opencvlibrary/files/ and untar it wherever
download cmake .dmg from http://www.cmake.org/cmake/resources/software.html and install it
i am assuming you have xcode 4.6 on os x lion which includes the ios sdk 6.1
go to xcode preferences to download and install the Command Line Tools so you have g++ etc.
Use cmake to compile opencv
go to the extracted opencv folder
create a build directory
mkdir build
cd build
cmake -D WITH_TBB=OFF -D BUILD_NEW_PYTHON_SUPPORT=OFF -D BUILD_FAT_JAVA_LIB=OFF -D BUILD_TBB=OFF -D BUILD_EXAMPLES=ON -D CMAKE_CXX_COMPILER=g++ CMAKE_CC_COMPILER=gcc -D CMAKE_OSX_ARCHITECTURES=x86_64 -D BUILD_opencv_java=OFF -G "Unix Makefiles" ..
make -j8
sudo make install
from the build folder, go to bin/ and run one of the tests
./opencv_test_stitching
Create your own c++ opencv xcode project
fire up xcode and create a new xcode project
select Command Line Tool for the type of project under os x
open your project's build settings
under Architectures, set Architecture to 64-bit intel. also set Valid Architectures to x86_64
under Build Options, set Compiler for C/C++ to Default Compiler
under Search Paths, set Header Search Paths to /usr/local/include
also under Search Paths, set Library Search Paths to /usr/local/lib
under Apple LLVM compiler 4.2 - Language set C++ Standard Library to libstd++ (For OpenCV 2.4.6, Xcode 5, LLVM 5.0, and 10.8.5, set both language dialect and std library to "Compiler Default" instead of "libstd++")
Add the compiled opencv libraries to your project
go the the Build Phases tab next to Build Settings tab you were in
inside Link Binary With Libraries, click on the + sign and choose Add Other
hit the front slash / on your keyboard and enter /usr/local/lib
hit enter and select the libraries you want to use in your project
make sure you always select libopencv_core.2.4.4.dylib
hit enter and you will see the selected dylibs under your project
write some code
first lets organize the files, right click on your project blueprint icon and select New Group
name the new group opencv or whatever
drag the dylibs and drop them in that group
open main.cpp
copy code from any of the sample tests that came with opencv and paste it here
make sure all the required dylibs are added, for example, if you copied the opencv_test_stitching.cpp code into main.cpp, you will need to add the following libraries in the previous steps
libopencv_core.2.4.4.dylib
libopencv_highgui.2.4.4.dylib
libopencv_stitching.2.4.4.dylib
Cheers.
It seems that your project is missing the framework AssetsLibrary.
Select the top node in the project navigator. (The project and targets page with the build settings appears.)
Select the target.
Select Summary.
Scroll down to Linked Frameworks and Libraries.
Click the Plus icon at the end of the table and select AssetsLibrary.framework.
Click Add.
Then try to build it again.
Since I can't seem to get an answer regarding the versions (neither here nor at the OpenCV Q&A site), I'm going to post this as an answer, as it at least solved the issue. This is described here.
In your project's Build Settings, go down to the section Apple LLVM compiler 4.1-Language.
There:
Set C++ Language Dialect to Compiler Default
Set C++ Standard Libray to libc++ (LLVM C++ standard libray with C++ 11 support
After doing the above, I stopped getting those linker errors, and only got one error instead, which stated that only iOS 5 and above is supported. Changing the Deployment Target to 5.0 in the project summery did the trick.
On a final note, I'm still not sure what it means, regarding OpenCV 2.4.3's compatibility with iOS versions older than 5.
clang: error: invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later) to remove this error.
GoTo BuildSettings. Set c++ standard library to compiler default. The
error will get removed surely.
Just to get this into the postings somewhere in case someone else runs into the same thing. If you follow all the great advice aboutsetting the proper c++ library to link against for building an iOS app BUT still get the link errors for undefined symbols make sure your code files are set to compile as c++! That is rename your .m to .mm and .h to .hpp. It's the little things...
Instead of using terminal commands given in the opencv installation guide in official website, use the following commands to build opencv from terminal. Worked for me.
cd OpenCV-2.3.1
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
sudo make install
Go Xcode/General/Linked Frameworks and Libraries
Press "+" button
type: AssetsLibrary
Select "AssetsLibrary.framework" and import it
Done
Good luck!

Resources