Trying to build and use Core-Plot 2.x - some really basic questions on build errors, etc.

423 views
Skip to first unread message

Andrew Voelkel

unread,
Oct 19, 2015, 7:25:14 AM10/19/15
to coreplot-discuss
Hello,

Background: I managed to get an earlier version of core-plot to work/build somehow with objective-C and display log-log frequency response plots for realtime audio filters I got working in iOS. I don't remember exactly how I did it, but I was very happy with the results. I'm relatively new to the iOS/Xcode ecosystem, but I'm a very experienced programmer.

Now I'm trying to do a version 2 of my code, deepen my understanding of Xcode, and also convert as much code as possible to Swift, since I vastly prefer it to Objective-C in those situations where it can be used. And I've got some probably basic and stupid questions.

First, I don't seem to be able to simply download the zip file for the latest version of core-plot, fire up the xcodeproj file in the frameworks folder with Xcode 7, and clean and rebuild it. I get errors about not being able to find .pch files. I would have thought that a clean and build would have rebuilt the .pch files. What do I do to be rid of these errors?

Second, I read in the release notes for core-plot 2.0 that "corePlot-CocoaTouch.xcodeproj project file is deprecated", but I still see it in the frameworks folder. Why?

Finally, for the folks that are not making changes to the framework itself, is there a place where only the standard binaries for the libraries and the header files (and the cocoapods stuff - for those that understand cocoapods) can be found, so that all consumers of core-plot don't need to build the frameworks a la GNU etc.? 

Please don't interpret my questions as a lack of gratefulness for the core-plot project. From what I got working on the last go-round, I can see that core-plot is an invaluable framework and I have nothing but gratitude for those that have tirelessly worked to create it and to improve it. The efforts made to support Swift are just the latest examples of the selflessness and dedication involved in supporting a project like this. I hope my cantankerous questions can serve to pave the way for others with similar inexperience with the iOS/Xcode ecosystem to make use of core-plot.

Thanks in advance for any help!

- Andy

Andrew Voelkel

unread,
Oct 19, 2015, 1:29:54 PM10/19/15
to coreplot-discuss
Update:

I deleted all the files in the framework folder of "core-plot-master 2" and recopied from the downloads folder. Then I rebuilt. For some reason, it worked this time. Maybe it is because I didn't have a specific target selected but instead had the project selected. Who knows - I'm grasping at straws.

I also saw how the example programs use core-plot by including the core-plot project as part of the app project. 

But is this the only way to use core plot? Can't it just be included as a Framework the way that many other Apple packages are? For someone just using the project - who doesn't want to peruse or modify the source code, it seems this would be more convenient, for a number of reasons. Is there a way to do this? In the past I somehow found the .a file and created a folder for the header files. It wasn't as neat as using a Framework, but it seemed more lightweight than including the whole core-plot project into my app project.

- Andy

Eric

unread,
Oct 19, 2015, 9:11:10 PM10/19/15
to coreplot-discuss
Second, I read in the release notes for core-plot 2.0 that "corePlot-CocoaTouch.xcodeproj project file is deprecated", but I still see it in the frameworks folder. Why?

"Deprecated" means it's still supported, but will go away in a future release. Release 2.0 merged the iOS static library and documentation targets into the main Core Plot Xcode project to keep everything together and make it easier to maintain. The corePlot-CocoaTouch.xcodeproj project is redundant and will be removed from the 2.1 release. It stayed in the 2.0 release to give everyone using it directly in their apps to update to the main project file instead.
 
Finally, for the folks that are not making changes to the framework itself, is there a place where only the standard binaries for the libraries and the header files (and the cocoapods stuff - for those that understand cocoapods) can be found, so that all consumers of core-plot don't need to build the frameworks a la GNU etc.? 
 
Core Plot releases are available on the releases page. You can download the source code, built frameworks and iOS static library, and the documentation there.

I also saw how the example programs use core-plot by including the core-plot project as part of the app project. But is this the only way to use core plot?

No. You can include the precompiled framework or iOS static library in your app project (see the wiki for details). You can also use Cocoapods or Carthage to include Core Plot in your app. The example apps all use the dependent project setup to keep them in sync with the latest changes to the Core Plot project.

Eric

Andrew Voelkel

unread,
Oct 20, 2015, 6:25:30 PM10/20/15
to coreplot-discuss
Eric,

Thank you. That was SO EASY once I found the framework. I was so embarrassed that I hadn't found them before that I retraced my steps trying to find them in the first place. After doing that, I was a little less embarrassed. Unless I'm missing something, the natural search path from Google to Github and the "how to deploy in an application" leads to a discussion of including the xcode projects into yours so that they can be built, which is the more complicated way to do. Then it discusses the static libraries afterwards. And the existence of an actual framework file isn't even mentioned.

I only mention this because I think the average user probably just wants to use the framework and go. Core plot is such a great thing, but the instructions could be made better by a) mentioning the static library method before the dependent project install method and b) updating the text to indicate that a framework file is available, which eliminates a few steps.

Thanks so much for your work on this project, with particular mention of the effort spent to ease use with Swift!

- Andy

Eric

unread,
Oct 20, 2015, 8:32:58 PM10/20/15
to coreplot-discuss
You're right, the wiki page needs an update. The iOS framework is new with release 2.0 and it isn't mentioned anywhere.

Thanks,
Eric

ramkumar chintala

unread,
Nov 3, 2015, 7:22:33 AM11/3/15
to coreplot-discuss
hi Eric. 
Coreplot 2.0 Triying using in swift . im stucked at Bridging header. what to omport here previously we are import #import "CorePlot-CocoaTouch.h" like this .but Coreplot 2.0 it was deprecated . so how to import coreplot in bridging header

Eric

unread,
Nov 3, 2015, 7:26:17 AM11/3/15
to coreplot-discuss
The separate project file for the iOS static library was deprecated, not the library itself. I merged the static library target into the main Core Plot project to keep everything together and make it easier to maintain. The CorePlot-CocoaTouch.h header still exists and will continue to be supported as long as the static library is.

Eric

Brooke

unread,
Nov 6, 2015, 4:21:20 PM11/6/15
to coreplot-discuss
HI Eric,

I am in the process of upgrading my projects to Core-Plot 2.0, using only the framework from CorePlot.xcodeproject.

After deleting references to CorePlot-CocoaTouch.h and the static library, I get an error that it can't find the header file. This is not surprising, but when I add

#import <CorePlot/CorePlot.h>

I still get errors.

I must be missing something simple, but I have not been able to located the solution from searching posts.  There are lot's of old fixes, for previous version. It gets a bit confusing.....

Could you please point me in the right direction?  

Thanks

Brooke


On Monday, October 19, 2015 at 6:11:10 PM UTC-7, Eric wrote:

Eric

unread,
Nov 6, 2015, 4:22:32 PM11/6/15
to coreplot-discuss
What errors are you getting?

Eric

Brooke

unread,
Nov 6, 2015, 5:53:38 PM11/6/15
to coreplot-discuss
To begin with:

Errors related to not finding CorePlot-Cocoatouch.h in the precompiled header.

I added the header file directory from a different release to the project, then I got an error that a derived data file was not present. 

I attached a screen shot showing the first error.
Screen Shot 2015-11-06 at 3.49.55 PM.png

Brooke

unread,
Nov 6, 2015, 5:57:54 PM11/6/15
to coreplot-discuss
Here's a screen shot of the file structure
Screen Shot 2015-11-06 at 3.55.49 PM.png

Brooke

unread,
Nov 6, 2015, 6:28:30 PM11/6/15
to coreplot-discuss

Eric

unread,
Nov 6, 2015, 7:23:39 PM11/6/15
to coreplot-discuss
With the framework, the import line should be:

#import <CorePlot/CorePlot.h>

Frameworks include the public headers as part of the framework folder. You shouldn't add any other Core Plot headers to your project. The CorePlot-CocoaTouch.h header is only for the iOS static library.

I'm working on updating that wiki page to clarify these issues.

Eric

Brooke

unread,
Nov 6, 2015, 7:54:27 PM11/6/15
to coreplot-discuss
Unfortunately, I tried that too.

This is the screen shoot of the result

There are NO headers visible in the framework folder  - anywhere!

I am first using core plot 1.6,  and Xcode 6.4 to make sure it works before moving onto Xcode 7.

Is this causing the trouble
Screen Shot 2015-11-06 at 5.50.19 PM.png

Eric

unread,
Nov 7, 2015, 7:59:04 AM11/7/15
to coreplot-discuss
The iOS framework was introduced with release 2.0. With version 1.6, you have to use the static library and the CorePlot-Cocoatouch.h header. Since the Core Plot API changed between 1.6 and 2.0, pick which version you want to use (I recommend 2.0 since that will make it easier to keep up with future updates) and get that one working in your app.

Eric

Brooke

unread,
Nov 7, 2015, 9:35:34 AM11/7/15
to coreplot-discuss
Thanks Eric,

That is my goal, however I was sneaking up on it. Trying to make sure I had the bugs worked out for each step of the transisition

What confused me is that the core-plot-release1.6 currently available has the same directory structure as the core-plot-release2.0. Both of those are different from the older working copy of release 1.6 i was using.  

Here's a screen shot showing the comparison.

I did not see the static library or header files in core-plot-release.16, so I thought this release would behave like release-2.0

Sorry for the false alarm! I just did not understand.

Brooke
Screen Shot 2015-11-07 at 7.29.39 AM.png

Brooke

unread,
Nov 7, 2015, 5:53:58 PM11/7/15
to coreplot-discuss
Hello again Eric,

I have switched to Xcode 7.0 beta 3 and core-plot-release-2.0

I updated Xcode to the recommended settings

I have successfully compiled and run CPTTestApp-iPhone from the examples

I am making the build phases and build settings of my app match the CPTTestApp-iphone settings

unfortunately, I am still getting the error:

CorePlot.h  "Cocoa/Cocoa.h" not found

I tried installing the latest command line tools package, but the error persists

Any idea what I may be missing?

Brooke
Screen Shot 2015-11-07 at 3.42.38 PM.png

Eric

unread,
Nov 8, 2015, 9:19:38 AM11/8/15
to coreplot-discuss
I'm confused. You app links the iOS static library, but it's trying to build the Core Plot framework. Which one do you want to use?

The CorePlot.h header includes the following import statements:

#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE


#import <Foundation/Foundation.h>

#import <UIKit/UIKit.h>


#else


#import <Cocoa/Cocoa.h>


#import <CorePlot/CPTDecimalNumberValueTransformer.h>

#endif


The Cocoa framework is only available on the Mac. Xcode is trying to compile your .pch file for a Mac app, not an iOS app. Check the build settings and make sure all of the platform settings point to iOS instead of the Mac.

I don't know that this has anything to do with the problem you're having, but Xcode 7.1 is out. Why are you using a beta of 7.0?

Eric

Brooke

unread,
Nov 8, 2015, 1:17:34 PM11/8/15
to coreplot-discuss
Thanks,

This is helping me understand. I want to use the framework, not the static library. I included the library because I saw it in the configuration of the  CPTTestApp.  


I am building for IOS. The app is supposed to be universal (iphone and Ipad).  I am not sure where the mac definition is coming from. I checked the devices under target-> general. it was set as universal.  I changed it to iPhone, did a clean, clean build folder and deleted  derived data., the recompiled.  I still get the same error. Attached are screen shots.  

I searched for 'device' under build settings and did not find any other places where that might be defined.  Are there other places I can check?

I am migrating my iPhone app. It is currently built using Xcode 6.4 and core-plot 1.6..  I have been forestalling the transition to Xcode 7.x and core-plot 2.0,  until I get the latest version approved for sale. Installing a new version of Xcode Tends to break my running version of Xcode 6.4.  In the interim, I am trying to understand the changes I will need to make by transitioning a test code.

I perhaps I should wait until it is safe for me to transition to Xcode 7.1. It seems there is something odd in the configuration.
Screen Shot 2015-11-08 at 11.08.05 AM.png
Screen Shot 2015-11-08 at 11.10.50 AM.png

Brooke

unread,
Nov 8, 2015, 1:53:44 PM11/8/15
to coreplot-discuss
I went so far as to force the definition of

TARGET_IPHONE_SIMULATOR 

in the .pch file, as shown in the attached screen shot.

It is somehow still not convinced that I want an IOS project......
Screen Shot 2015-11-08 at 11.49.38 AM.png

Eric

unread,
Nov 8, 2015, 4:18:01 PM11/8/15
to coreplot-discuss
On the "Build Settings" tab (select "All" to see all of the settings):

  • Supported Platforms: iOS
  • Base SDK: Latest iOS
  • iOS Deployment Target: iOS 8.0 or higher (required for frameworks)
  • Targeted Device Family: make sure this is set
Make sure any setting that references "OS X" is blank.

Eric

Brooke

unread,
Nov 8, 2015, 4:29:58 PM11/8/15
to coreplot-discuss

I decided to start over and had some success.

1) Copied old project to a new directory
2) loaded it into Xcode
3) Delete->remove reference to static library, headers and project
4) Drag 'core-plot-release-2.0.xcodproject' into my project 
5) Build settings->  header Search Paths  added : '$(PROJECT_DIR)/../../framework, recursive' ( need this to find coreplot-cocoatouch.h)
5) Build settings-> user header Search Paths  added : '$(PROJECT_DIR)/../../framework, recursive' ( need this to find coreplot-cocoatouch.h)
6) Build Settings-> always search user paths YES
7) build phases-> target dependencies coreplot-cocoaatouch
8) attempt to build ( can't skip this part, though most on-line instructions assume that the library will be present, which it is not - or at least I can't find it)
9) now  build phases->link with libraries coreplot-cocoatouch.a
10) copy ( actually copy) header files directory from early version of core plot-release 1.6 ( latest download does not have these files)
     NOTE: I think this is where I got the previous "cocoa.h" error. I found some links to header files in the release, but they were for mac only.
11) compile again..... success!

Hopefully I will be able to transition to the framework from here.

Are these the correct path settings to make sure the headers in the framework can be found?  It seems to compile the library without issues, but it complains about not finding headers when my project code compiles.

Eric,

Thanks for your patience and help.  It is frustrating to debug remotely, so I am grateful that you can provide guidance.

Eric

unread,
Nov 8, 2015, 4:36:51 PM11/8/15
to coreplot-discuss
The header search paths will depend on where you stored the release package. That path works for the Core Plot examples because both the framework and example apps are in the same parent folder. You don't usually need both header settings; just the "Header Search Paths" should be sufficient.

Eric

Brooke

unread,
Nov 8, 2015, 4:41:18 PM11/8/15
to coreplot-discuss
THanks,

All these were set as you recommended.
The only thing I found with OS X mentioned was: under "Deployment"  see attached screenshot.
What is odd here is the: '(null) Deployment' section for IOS at the bottom.  Perhaps this has been the issue?

There was something corrupted in this particularly project.
Screen Shot 2015-11-08 at 2.38.05 PM.png

Brooke

unread,
Nov 8, 2015, 4:44:53 PM11/8/15
to coreplot-discuss
So... if I store the release at  

/Users/ME/src/core-plot-release-2.0

the set path should be ?

/Users/ME/src/core-plot-release-2.0   <recursive set>

or 

/Users/ME/src/core-plot-release-2.0/framework     <recursive set>

?

Eric

unread,
Nov 8, 2015, 4:54:19 PM11/8/15
to coreplot-discuss
I forgot you wanted to use the framework. Xcode should look inside any linked frameworks automatically. You don't need to set the search path at all. 

If you choose the static library (which it looks like you did when you rebuilt the project setup), then you do need the header search path. If you unzip the release files to /Users/ME/src/core-plot-release-2.0, the iOS headers will be in /Users/ME/src/core-plot-release-2.0/Binaries/iOS/CorePlotHeaders/. The CorePlot-CocoaTouch.h header is only for the static library.

Eric

Brooke

unread,
Nov 8, 2015, 5:12:32 PM11/8/15
to coreplot-discuss
I am heading towards the framework method.

I have not been able to find any directory called "Binaries" in the current 2.0 or current 1.6 release. I was expecting to find them.

There is an earlier screen shot showing the directory structure of the current 1.6 , current 2.0 and previous 1.6 versions. Only the old 1.6 release has that directory, or if the current releases do, I can not see them.
Screen Shot 2015-11-08 at 3.08.21 PM.png

Eric

unread,
Nov 8, 2015, 5:17:57 PM11/8/15
to coreplot-discuss
I'm talking about the zip files you can get from the releases page. If you pull the code directly with git, then "/Users/ME/src/core-plot-release-2.0/framework     <recursive set>" should work.

Eric

Brooke

unread,
Nov 8, 2015, 5:39:17 PM11/8/15
to coreplot-discuss
I used core-plot-release-2.0.tar from the releases page.

I will try to use git next.

BTW..... Copying the working ,static library directory to a new one then
1) deleting reference to oreplot-cocoatouch.xcodeproject
2) removing headers
3) adding core plot.h
4) adding compile dependency to core plot framework IOS 
5) compiling
6) adding framework IOS) to link 

produced the same cocoa.h h error.

I will try to download directly from git.

Sighh....  so close....

Thanks,

Brooke

Eric

unread,
Nov 8, 2015, 5:45:16 PM11/8/15
to coreplot-discuss
Make sure you've got the iOS version of the framework. This is new with release 2.0. You'll find it in the Binaries/iOS folder in the release package. The only Core Plot framework in previous releases was for the Mac only.

Eric

Brooke

unread,
Nov 9, 2015, 9:18:29 AM11/9/15
to coreplot-discuss
Thanks Eric,,

First thing this morning, I:

1) went to github and downloaded the zip file. It created a folder 'core-plot-master' . I copied this file to ~/src/CorePlot. See the screenshot for the directory structure.
2) I opened cleared the previous coreplot.xcodeproject from my project.
3) I added (right-click add files to project) the coreplot.xcodeproject from the new location to my project
4) added a dependency to the IOS version
5) added a link with binary to the IOS version
6) I changed the header file path to ~/src/CorePlot/core-plot-master/framework
7) compiled.
     It compiled the framework - no errors
     if failed while compiling the pch file for my project (see screen shot)


Please see the 4 attached screen shots.

Note: NO sign of Binaries/IOS folder in core-plot-master ( see attached) or in file list on GitHub.  Directory structure of core-plot-release-1.6 has changed since May 2015!

I can get my project to compile using the static library, using the core plot.xcodeproject ( using CPTTestApp-iphone as an example) and setting only header path to ~/src/CorePlot/core-plot-master. I get the appropriate NSDecimal errors, so I know this is working. With this method, I don't need to explicitly include the core plot-cocoatouch.h file or the header files in my project.

It seems as though the IOS framework has some sort of problem which is reading a mac version file.  This could be my version of Xcode.

At this point, a couple of  paths seem open:

1) I can use the static library to start debugging my code and making the transition to core plot 2.0. This is almost where I wanted to be, but it is good enough for now!

2) my Xcode version (7.0 beta 3) is not going to work with frameworks, so i should wait until I can safely change to 7.1 or 7.2 beta.  

3) Have you try to duplicate the error and see if there truly is a problem in the core plot distribution. If you can't then the problem is my system....

For the near future, it looks like upgrading to the IOS framework is not an option.

Thank you again for all you help. 


Brooke
Screen Shot 2015-11-09 at 6.35.12 AM.png
Screen Shot 2015-11-09 at 6.37.32 AM.png
Screen Shot 2015-11-09 at 6.50.19 AM.png
Screen Shot 2015-11-09 at 7.05.53 AM.png

Brooke

unread,
Nov 9, 2015, 10:05:36 AM11/9/15
to coreplot-discuss
One last diagnostic.......

I started by copying a  clean project, which worked using the static library. i compiled it and it worked. There is no copy of core plot-cocoatouch.h or the header files in the directory structure. Only the CorePlot.xcodproject is present. Header path is approrpriate.

I then modified it to use the IOS framework from the github core-plot-master directory (zip file). This fails giving me the 'cocoa.h' not found error.

I then modified it back to the static library. as a test, except I left the '#import <Coreplot/CorePlot.h> in the .pch file

 It fails giving me the cocoa.h error.

I change the .pch file back to "include "CorePlot-CocoaTouch.h".  Compiling works.

I changed nothing in the settings other than the dependency and link to libraries. The only other change was to the .pch file

Eric Skroch

unread,
Nov 9, 2015, 11:27:57 AM11/9/15
to coreplot...@googlegroups.com
You downloaded the source code package the GitHub creates automatically, not the release package. Download https://github.com/core-plot/core-plot/releases/download/release_2.0/CorePlot_2.0r1.zip to get the full release.

Eric
--
You received this message because you are subscribed to the Google Groups "coreplot-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coreplot-discu...@googlegroups.com.
To post to this group, send email to coreplot...@googlegroups.com.
Visit this group at http://groups.google.com/group/coreplot-discuss.
For more options, visit https://groups.google.com/d/optout.

Brooke

unread,
Nov 9, 2015, 12:59:10 PM11/9/15
to coreplot-discuss
Eric,

I downloaded and installed CorePlot_2.0r1, using your link ( thank you). Binaries/IOS directory is present :-)


I compiled successfully using the static library, and used that  version to fix the NSDecimal / NSNumber issues.

I then slowly transitioned to the framework.
in pch file:

#import "CorePlot-CocoaTouch.h"

//#import <CorePlot/CorePlot.h>


1) added dependency to framework , keeping static library : compiles and runs
2) added link to framework. keeping link with static library : compiles and runs
3) changed header in pch file :

//#import "CorePlot-CocoaTouch.h" 
#import <CorePlot/CorePlot.h>         : compiles fails with 'cocoa.h not found. framework builds
 4) in .pch file


#import "CorePlot-CocoaTouch.h"

#import <CorePlot/CorePlot.h>       : compiles fails with 'cocoa.h not found. framework builds


5) 

#import "CorePlot-CocoaTouch.h"

#define TARGET_IPHONE_SIMULATOR 1

#define TARGET_OS_IPHONE  1

#import <CorePlot/CorePlot.h>   : compiles fails with 'cocoa.h not found. framework builds.


So I can't even force it to NOT go down that branch in CorePlot.h


Eric

unread,
Nov 9, 2015, 8:40:27 PM11/9/15
to coreplot-discuss
This is a dumb oversight on my part. Insert the following line at the beginning of CorePlot.h:

#import "TargetConditionals.h"


This is the file that defines all of the target macros. This fix is now on the Master branch and will be part of the next release.

Thanks for helping me work through this issue.

Eric
Reply all
Reply to author
Forward
0 new messages