Framework headers not found (related to versions?)

Discussion in 'iOS Programming' started by ArtOfWarfare, Apr 28, 2013.

  1. ArtOfWarfare macrumors G3


    Nov 26, 2007
    I'm trying to compile a project that includes a framework. Inside the .framework folder the file named Headers is just a data file that contains "Versions/A/Headers" (quotes added for clarity). Inside the actual source files for the project some have the import statement

    #import <(framework)/(header).hpp>
    (header).hpp (not the actual name of the file) is located at (framework).framework/Versions/A/Headers/(header).hpp

    There's also a file (framework).framework/Versions/Current that's a data file that just contains "A" (quotes added for clarity). I'm getting the compile error

    '(framework)/(header).hpp' file not found

    How can I resolve it?

    I cloned this project from github and this is me just making sure that the project currently compiles and runs on my iPhone, if that makes any difference.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Things to look at:

    Header search path for the project may need to include the framework.
    Look at the command line for the framework headers path.
    Look at the framework project to see if the header files are copied or not. Are they marked public or private.
    Is there no sample project that comes with the framework?
  3. ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    After looking inside of other frameworks, I have concluded that these files, Current, Headers, and Resources, contained within the .framework file, shouldn't be recognized as documents, but as aliases to other files. Opening them in a text editor reveals nothing except a relative path to another folder of the same name. Based on the amount of bytes the files contain and the amount of bytes that aliases contain, I'm fairly certain these files should be folder aliases but OS X is misinterpreting it or something...

    I can't seem to do a hexdump on an alias though... when I do

    $ hexdump /tmp
    for example, it prints out that I can't use hexdump on a directory, even though within Finder I can see that that is a hidden alias.
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    What's the project on GitHub and does it have installation instructions?
  5. ArtOfWarfare, Apr 28, 2013
    Last edited: Apr 28, 2013

    ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    No. It is a private repository that has no installation instructions. It has been committed once, by the prior person working on the project who was fired from the company a few months ago, and I'm now taking over from them.

    After searching around Google, I believe that GitHub will sometimes change SymLinks into plain text files depending on how you have it configured (possibly it's desirable if you'll be working on the repository from a Windows computer?)

    Can I somehow use chmod to change the files back into SymLinks? All I want is to change the - that appears on the file when I use
    ls -l
    to change into a l... as far as I can tell, all a symlink is is a text file with a single bit set that tells the OS to treat it as a directory. I'm reading through the man page for chmod and I'm not quite sure how to set that specific bit, though.

    Edit: And after playing around with chmod for a while, I believe I've learned all about it (this Wikipedia page proved extraordinarily helpful) but it doesn't change the bit(s) that I want.

    chflags doesn't seem to have any promising leads...

    Good lord it's like nobody ever has had this problem in the history of the internet.

    2X Edit: I wrote this script which automatically fixes everything:

    # Fix Symlinks
    while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
      DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
      SOURCE="$(readlink "$SOURCE")"
      [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
    DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
    function fix () {
      lines=$(wc -l < $fromFilePathAndName)
      if ( [[ $fromFilePathAndName != *\.DS_Store ]] && [ "$lines" -lt "2" ] ) then
        echo $fromFilePathAndName "->" $fromFileContents
        rm $fromFilePathAndName
        ln -s $fromFileContents $fromFilePathAndName
    find $DIR -type f | while read file; do fix "$file"; done
    Place it in the directory of your framework, run it (your PWD/CWD shouldn't matter when you run it - it should always fix the files around wherever the script is located), and the symLinks that GitHub breaks should be restored.

    If anyone has a simpler solution, I wish you had shared it sooner because I just wasted 6 hours into coming up with this.

    Oh... and this is kind of greedy... it'll grab onto any file not named .DS_Store that's of only 0 or 1 lines and replace it with a symlink. I have no idea what it does if finds some other binary document (IE, an image document.) Hopefully your framework doesn't contain any of those or it may well screw those up.
  6. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Yes, there are two or three links inside a valid framework. I hadn't heard that github messed them up. In theory there can be multiple versions of the framework headers and source code inside a single framework folder, which is the purpose of the links. I don't think I've ever seen one really set up like that though.

    The links have specific names and point to specific folders so your script could just validate that the expected links are present. Or you could have a short script inside your project that creates the links if they don't exist. I think that the framework is built from scratch after you do a clean so there should be something that builds the links in the project.
  7. ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    I don't know where the framework came from. I've been told it's a modified version of opencv2, but I wasn't given the source/project for it.
  8. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    I wouldn't use a framework without source code. It will become defunct at some point. What then?

    And all the more point that it's not worth writing a script to fix up a framework that just requires a few links to be fixed up.
  9. ArtOfWarfare thread starter macrumors G3


    Nov 26, 2007
    Writing the script doubled as a learning experience for me since I have minimal experience with bash.

Share This Page