iOS Custom Framework .framework file - ios

I've followed this tutorial:
https://github.com/jverkoey/iOS-Framework
and have everything working on the development end. Even the dependent product works fine. In the end I have a .framework, .a, headers folder, and include folder after building. The article says you just have to drag the .framework over to your project and include #include However, when I do this and build I get a linker error:
ld: framework not found MyFramework
Please remember, I have this working, linking, etc in my dependent project but in that project I copied the Framework project into the Testing project. Are there missing steps I have to do after dragging the .framwork over? I've tried dragging the .a as well with no success (same error message).
Thanks for any and all help.

Are you sure you have the framework structure completely correct? Since you were just using it as a subproject before you may well not be building the framework directory correctly.
It should look like:
MyFramework.framework //(directory)
info.plist
MyFramework //(symbolic link to Versions/Current/MyFramework)
Resources //(symbolic link to Versions/Current/Resources)
Headers //(symbolic link to Versions/Current/Headers)
Versions //(directory)
Current //(symbolic link to directory "A" below)
A //(directory)
Headers //(directory containing framework headers)
Resources //(directory holding framework resources)
MyFramework //(actual compiled library, really a .a file)
The .a file in your framework should not end in .a. And as noted all of those symbolic links have to be right, an "ls -l" in your framework directory should look like:
drwxr-xr-x 7 kendall admin 238B Feb 19 13:36 ./
drwxr-xr-x 11 kendall admin 374B Feb 19 13:36 ../
lrwxr-xr-x 1 kendall admin 24B Feb 19 13:36 Headers# -> Versions/Current/Headers
lrwxr-xr-x 1 kendall admin 30B Feb 19 13:36 MyFramework# -> Versions/Current/MyFramework
lrwxr-xr-x 1 kendall admin 26B Feb 19 13:36 Resources# -> Versions/Current/Resources
drwxr-xr-x 4 kendall admin 136B Feb 19 13:36 Versions/
-rw-r--r-- 1 kendall admin 215B Feb 19 13:36 info.plist
The contents of info.plist (which tells the linker what the name of the static library in the framework really is) look like:
CFBundleDevelopmentRegion
English
CFBundleExecutable
MyFramework
CFBundleIdentifier
com.pushio.pushiomanager
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
FMWK
CFBundleSignature
????
CFBundleVersion
1.0.0

*) I suppose you missed clicking the checkbox "Copy items into destination groups folder(if needed)" when you dragged or copied the framework over.
*) And also make sure you link the framework by going to project -> targets -> Build phases ->Link binary with Libraries and adding the framework.

In the above tutorial you need to make sure you remove the Copy Files Build phase that the latest version of XCode adds. This was caused because of this step. Everything else was correctly added.

Related

Jenkins compiler warnings plugin not showing C or C++ source code

My build script includes
make clean
make all
make invokes gcc:
gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
my post-build step is to, "scan for compiler warnings" and I chose the parser for GNU C Compiler 4 (gcc).
Is that enough? Did I miss anything?
My console log shows
[WARNINGS] Parsing warnings in console log with parser GNU C Compiler 4 (gcc)
[WARNINGS] Computing warning deltas based on reference build #72
When I click on the compiler warnings chart and drill down to a single source file, I get
Copying the source file '../software_under_test/maths.c' from the workspace to the build folder '8410a4f3.tmp' on the Jenkins master failed.
02 Seems that the path is relative, however an absolute path is required when copying the sources.
03 Is the file 'maths.c' contained more than once in your workspace?
04 Is the file '../software_under_test/maths.c' a valid filename?
05 If you are building on a slave: please check if the file is accessible under '$JENKINS_HOME/[job-name]/../software_under_test/maths.c'
06 If you are building on the master: please check if the file is accessible under '$JENKINS_HOME/[job-name]/workspace/../software_under_test/maths.c'
07 java.io.IOException: Failed to copy ../software_under_test/maths.c to /home/mawg/.jenkins/jobs/plain_C_project/builds/73/workspace-files/8410a4f3.tmp
08 at hudson.FilePath.copyTo(FilePath.java:1991)
09 at hudson.plugins.analysis.util.Files.copyFilesWithAnnotationsToBuildFolder(Files.java:80)
10 at hudson.plugins.analysis.core.HealthAwareRecorder.copyFilesWithAnnotationsToBuildFolder(HealthAwareRecorder.java:312)
11 at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:89)
12 at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:259)
13 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:75)
14 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
15 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
16 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
17 at hudson.model.Build$BuildExecution.post2(Build.java:185)
18 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
19 at hudson.model.Run.execute(Run.java:1766)
20 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
21 at hudson.model.ResourceController.execute(ResourceController.java:98)
22 at hudson.model.Executor.run(Executor.java:408)
23 Caused by: java.io.FileNotFoundException: ../software_under_test/maths.c (No such file or directory)
24 at java.io.FileInputStream.open(Native Method)
25 at java.io.FileInputStream.<init>(FileInputStream.java:146)
26 at hudson.FilePath$41.invoke(FilePath.java:2017)
27 at hudson.FilePath$41.invoke(FilePath.java:2012)
28 at hudson.FilePath.act(FilePath.java:991)
29 at hudson.FilePath.act(FilePath.java:969)
30 at hudson.FilePath.copyTo(FilePath.java:2012)
31 at hudson.FilePath.copyTo(FilePath.java:1986)
32 ... 14 more
What am I doing wrong?
This page says that the code is looking for the string "Entering directory" in the build output and the code verifies this.
I tweaked my make step to output that by adding the --print-directory to the make command and got
+ make all --print-directory
make: Entering directory `/home/mawg/workspace/unit_test_C_code_example_project/Debug'
Building file: ../test_scripts/test_maths.c
Invoking: GCC C Compiler
gcc -DUNIT_TEST -I"/home/mawg/workspace/unit_test_C_code_example_project/mocks" -I"/home/mawg/workspace/unit_test_C_code_example_project/software_under_test" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test_scripts/test_maths.d" -MT"test_scripts/test_maths.d" -o "test_scripts/test_maths.o" "../test_scripts/test_maths.c"
Finished building: ../test_scripts/test_maths.c
etc, but that did not help.
So, can anyone tell me how to configure things so that I an drill down into the source code from the Jenkins compiler warnings plugin?
This was one of the first results when I had this problem, but I have since found that as of at least 2018-07 there is an advanced setting to “Resolve relative paths” (not sure when this was added), but this solved the same problem for me
Update:
After adding the Scan for compiler warnings Post Build action in Jenkins, there will be an Advanced button.
After clicking Advanced a list of options appears. Some way down this list there is a section titled Resolve relative paths, clicking on this solved my problem.
This was in the Warning plugin version 4.66
Solved!
I had the same Problem and got rid of it after following changes:
I set the at the Source Code Management-->Local module Directory
a Period following the checkout Folder of the Project i.e. "./project1"
I didnt have the "./" before.
I added also to the make command the Option --print-directory.
Now it works as expected!
Ok, solved!
The problem was that the makefile generated by Eclipse contain ed a relative path. Relative to the makefile directory that it, but the Jenkins compiler warning plugin was treating it as relative to the Jenkins workspace.
The solution is to edit the makeilfe. Do it once for a manually created makefile. If you use Eclipse it constantly regenerates the makefiles, so the trick is to edit the Jenkins shell script to change the makefile on the fly, immediately prior to building.
Note that I only changed the makefile for the Software Under Test directory. I am not interested in compiler warnings in Google Test, etc
So, now my Jenkins shell script starts
cd /home/mawg/workspace/unit_test_C_code_example_project/Debug
# Tweak the makefile to use an absolute path to the Software Under Test.
# If we use a relative path then the Jenkins comiler wanrings plugin
# cannot find the source code to display it, so that we can drill down
# into it and see the compiler warnings in situ.
sed 's|\.\./software_under_test/maths.c|/home/mawg/workspace/unit_test_C_code_example_project/software_under_test/maths.c|g' /home/mawg/workspace/unit_test_C_code_example_project/Debug/software_under_test/subdir.mk > /home/mawg/workspace/unit_test_C_code_example_project/Debug/software_under_test/subdir.mk.absolute
rm software_under_test/subdir.mk
mv software_under_test/subdir.mk.absolute software_under_test/subdir.mk
make clean
# The --print-directory option is required for the compiler warning plugin
make all --print-directory

ant debug failed to include gdb.setup in the apk file

I've been building (from a mac terminal) this native application successfully for a long time but today I've run across an error I can't seem to pin down. After tiring from all the javac warnings I upgraded to a newer version of ant. I'm not sure it is related but the timing is suspect. I can still build, deploy, and run my application but now I can no longer use ndk-gdb to debug the native part of the application. It appears on inspection that the gdb.setup file is not getting added to the debug apk.
here is the build sequence, abbreviated output, and information. I'm looking for suggestions on how to resolve the issue.
I've done a full clean on both NDK and ant builds
The android NDK version and android SDK versions are all up to date.
I use the built in ndk-bundle that gets loaded with the android studio sdk tools.
The devices we develop on are not rooted and is not an option.
hsmith$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
hsmith$ $ANT_HOME
-bash: /Users/hsmith/dk/ant/apache-ant-1.9.6: is a directory
hsmith$ ndk-build -j4 NDK_DEBUG=1
[armebi-v7a] Gdbserver : [arm-linux-androideabi-4.8] libs//gdbserver
[armebi-v7a] Gdbsetup : libs//gdb.setup
[armebi-v7a] Install : lib1.so => libs/armebi-v7a/lib1.so
[armebi-v7a] Install : lib2.so => libs/armebi-v7a/lib2.so
[armebi-v7a] Install : lib3.so => libs/armebi-v7a/lib3.so
hsmith$ ant debug
…
-package:
[apkbuilder] Found modified input file
[apkbuilder] Creating -debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /Users/hsmith/packageFolder/bin/<package>-debug.apk
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
-post-build:
debug:
BUILD SUCCESSFUL
hsmith$ adb install -r ~/packageFolder/bin/-debug.apk
hsmith$ ndk-gdb adb --start
ERROR: Package is not debuggable ! You can fix that in two ways:
Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'.
Modify your manifest to set android:debuggable attribute to "true",
then rebuild normally.
After one of these, re-install to the device!
I unzipped the apk file to find
unziped apk file/lib/target/
hsmith$ ls -la
total 48264
drwxr-xr-x 12 hsmith staff 408 Aug 25 14:50 .
drwxr-xr-x 5 hsmith staff 170 Aug 25 14:50 ..
-rwxr-xr-x 1 hsmith staff 409940 Jun 3 11:47 gdbserver
-rwxr-xr-x 1 hsmith staff 33920 Aug 25 14:44 lib1.so
-rwxr-xr-x 1 hsmith staff 165092 Aug 25 14:44 lib2.so
-rwxr-xr-x 1 hsmith staff 1614028 Aug 25 14:44 lib3.so
note there is no gdb.setup file
I don't use debuggable=true in the manifest because it isn't needed anymore however including it has no affect on the result.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455
This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455 This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.

iOS Cydia THEOS, make install, Could not find deb package

I followed the instructions here and it happens in both tweak and app:
http://iphonedevwiki.net/index.php/Theos/Setup#Creating_a_Project
But I don't see any .deb files
RoverMR-2:testapp rover$ find . -name "deb"
Here are several relevant command output logs:
https://gist.github.com/anonymous/42b4a086d6b7ee792b08
I just see this in packages:
RoverMR-2:testapp rover$ ls -la .theos/packages/
total 8
drwxr-xr-x 3 rover staff 102 Apr 30 11:12 .
drwxr-xr-x 4 rover staff 136 Apr 30 11:12 ..
-rw-r--r-- 1 rover staff 1 Apr 30 11:12 com.mysite.testapp-0.0.1
RoverMR-2:testapp rover$ make package
/Users/rover/Documents/Dev/Cydia/Theos/apps/testapp/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application testapp...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling testappApplication.mm...
Compiling RootViewController.mm...
Linking application testapp...
Stripping testapp...
Signing testapp...
Making stage for application testapp...
RoverMR-2:testapp rover$
RoverMR-2:testapp rover$ ls
Makefile RootViewController.h _ main.m testappApplication.mm
Resources RootViewController.mm control obj theos
RoverMR-2:testapp rover$
the error:
RoverMR-2:testapp rover$ make install
/Users/rover/Documents/Dev/Cydia/Theos/tweaks/testtweak/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Could not find "./com.yourcompany.testtweak_0.0.1-10_iphoneos-arm.deb" to install. Aborting.
I posted an issue about this https://github.com/DHowett/theos/issues/120
Type make package install all at once in the tweak's directory.

'FacebookSDK/FacebookSDK.h' file not found

I already installed the latest version of phonegap-facebook-plugin
But when i build the project, I got the error message below.
I tried many solutions mentioned at stackoverflow and other websites with no positive result.
com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m:11:
Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.h:11:9: fatal error:
'FacebookSDK/FacebookSDK.h' file not found
#import <FacebookSDK/FacebookSDK.h>
^
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/Et3arrafApp.build/Debug-iphonesimulator/Et3arrafApp.build/Objects-normal/i386/FacebookConnectPlugin.o Et3arrafApp/Plugins/com.phonegap.plugins.facebookconnect/FacebookConnectPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: /Users/apple/Desktop/et3arraf/platforms/ios/cordova/build: Command failed with exit code 65
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I encountered the same problem today.
Installing this plugin using the plugin register does not work (for iOS) at the moment.
You must clone the repository (phonegap-facebook-plugin) to your local file system, say $HOME/src/phonegap-facebook-plugin. And then install the plugin pointing to that path, e.g. cordova plugin add $HOME/src/phonegap-facebook-plugin
...
It turns out that FacebookSDK.framework isn't installed properly when fetching through the plugin registry. It should look like this:
$ ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
total 24
lrwx------ 1 mjl staff 24 Aug 15 15:23 FacebookSDK -> ./Versions/A/FacebookSDK
lrwx------ 1 mjl staff 20 Aug 15 15:23 Headers -> ./Versions/A/Headers
lrwx------ 1 mjl staff 22 Aug 15 15:23 Resources -> ./Versions/A/Resources
drwx------ 4 mjl staff 136 Aug 15 15:23 Versions
But the symlinks aren't preserved when installing through the plugin registry... They are preserved when installing from the local file system though.
I had solved it by installing the plugin using --save option.
in my case I had downloaded the plugin to my computer and what I did is :
cordova plugin add --save <my downloaded plugin directory> --variable APP_ID=<app_id> --variable APP_NAME=<app_name>
The required file will be listed same as #mjl's result from ls -l plugins/com.phonegap.plugins.facebookconnect/platforms/ios/FacebookSDK.framework/
P/S: if you are using iTerm, you can drag the folder into your iTerm terminal and the full directory path will be type in automatically.
After more and more search around the web, I tried to re create the sym link of Headers, FacebookSDK and Resources and resolved
ln -s ./Versions/A/Headers Headers
and so on

Phonegap doesn't copy plugin files to ios platforms directory during build

rm -rf plugins/*
rm -rf platforms/*
phonegap build ios //this works
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap build ios
Building for ios after adding a plugin fails. Here is the error:
** BUILD FAILED **
The following build commands failed:
CompileC build/PondMD.build/Debug-iphoneos/PondMD.build/Objects-normal/armv7/CDVDevice.o PondMD/Plugins/org.apache.cordova.device/CDVDevice.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
2014-01-16 10:32:15.055 xcodebuild[69605:1007] [MT] PluginLoading: Required plug-in compatibility UUID 37B30044-3B14-46BA-ABAA-F01000C27B63 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XCode4_beginning_of_line.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-01-16 10:32:16.630 xcodebuild[69605:4203] DVTAssertions: Warning in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:78
Details: Failed to load dependencies output contents from ``/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d''. Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “CDVDevice.d” couldn’t be opened because there is no such file." UserInfo=0x7fe7a57a7440 {NSFilePath=/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d, NSUnderlyingError=0x7fe7a57aaed0 "The operation couldn’t be completed. No such file or directory"}. User info: {
NSFilePath = "/Users/william/working/PhonegapPondMD/platforms/ios/build/PondMD.build/Debug-iphonesimulator/PondMD.build/Objects-normal/i386/CDVDevice.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}.
Function: void XCGccMakefileDependenciesParsePathsFromRuleFile(NSString *__strong, F) [F = <lambda at /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-3575/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/SpecificationTypes/XCGccMakefileDependencies.m:168:73>]
Thread: <NSThread: 0x7fe7a57ab420>{name = (null), num = 7}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
The issue seems to be that phonegap is not copying the objective-c classes and headers into /platforms/ios/
william-macbook-pro:PhonegapPondMD william$ ls -l plugins/
total 8
-rw-r--r-- 1 william staff 296 Jan 16 10:32 ios.json
drwxr-xr-x 11 william staff 374 Jan 16 10:30 org.apache.cordova.device
william-macbook-pro:PhonegapPondMD william$ ls -l platforms/ios/PondMD/Plugins/
total 8
-rw-r--r-- 1 william staff 890 Jan 16 10:30 README
william-macbook-pro:PhonegapPondMD william$ phonegap -v
3.3.0-0.18.0
I had the same problem, and I solved It creating the project with uppercase in the first letter of project name. Yes, it seems incredible, but this was the solution.
I ran into the same issue and solved it by using the instructions here: Cordova 3.2 ios add plugin "Which config.xml? Where is it?"
To summarize, I did the following steps:
1. Removed ios platform via: cordova platform remove ios
2. Re-installed the plugin
3. (Re-)Added the ios platform via: cordova platform add ios
4. Built the project again
After this, it built just fine.
When I added the plugin using cordova plugin add command, it puts the plugin code inside a plugins folder.
When you inspect the plugin folder inside the ios platform, you would see the plugin is not available.
So I created a folder with the same name as the plugin name and copied the files from the plugin src/ directory into this. After this the project built correctly.
I also found it useful to open the native project in xcode to inspect the project closer.
I went with the solution to copy the plugin files from ./plugins/.. to the ios platform plugin directory. Whoever needs it, here is a little helper for gulp.
(npm install gulp gulp-rename)
(gulpfile.js)
var gulp = require("gulp");
var rename = require("gulp-rename");
gulp.task("cp-plugins-ios", function(){
gulp.src(["./plugins/*/src/ios/*"],{base: 'ios'}).pipe(rename(function(path){
var myDir = path.dirname.replace("src/ios","");
path.dirname = myDir;
})).pipe(gulp.dest("./platforms/ios/projectName/Plugins/"));
});

Resources