Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Fixing OS X 10.10 CMake "built for unsupported file format" Errors  (Read 4029 times)

0 Members and 1 Guest are viewing this topic.

anthnich

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Long Division LLC
Hi, I just wanted to share how I fixed a problem with SFML 2.1 (from repo) and CMake with OS X 10.10 (Yosemite).

If you run make, you may encounter an error with freetype and/or sndfile that says something along the lines of "built for unsupported file format, which is not the architecture being linked".

To fix the error, go to the CMake entries for freetype and sndfile. Their paths will end with:

Quote
/extlibs/libs-osx/Frameworks/freetype.framework
/extlibs/libs-osx/Frameworks/sndfile.framework

Change these entries to:

Quote
/extlibs/libs-osx/Frameworks/freetype.framework/Versions/A/freetype
/extlibs/libs-osx/Frameworks/sndfile.framework/Versions/A/sndfile

And everything should make just fine.




Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Fixing OS X 10.10 CMake "built for unsupported file format" Errors
« Reply #1 on: November 03, 2014, 06:48:19 pm »
Nope, this is not the way to go. It will break other things.

If you get an error, post the exact message.
SFML / OS X developer

anthnich

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Long Division LLC
Re: Fixing OS X 10.10 CMake "built for unsupported file format" Errors
« Reply #2 on: November 03, 2014, 08:17:53 pm »
Nothing seems to be broken when I successfully make this way. My project compiles and runs fine after this. Everywhere I see this problem brought up, no one has an answer for it. I read somewhere one person recommended that for similar errors, you specify deeper in the framework like in my post above. Lo and behold, it worked.

I went ahead and ran make with everything vanilla and these are the errors:

Quote
ignoring file /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (i386): /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype
Undefined symbols for architecture i386:

That is with architecture i386;x86_64 specified. If I remove it, it says:

Quote
ignoring file /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (x86_64): /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype
Undefined symbols for architecture x86_64:

Sndfile will throw an error just like that as well. Using my solution, everything compiles and runs fine.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Fixing OS X 10.10 CMake "built for unsupported file format" Errors
« Reply #3 on: November 03, 2014, 08:21:15 pm »
It's simply because /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype is a symlink to freetype.framework/Versions/A/freetype (approximately, see Apple's doc about frameworks for more details) and this symlink is broken for some reason on your system.

Maybe it's your unzip program fault. It happened to a few people in the past but works fine for the majority.

How did you get SFML sources and how did you extract them?
SFML / OS X developer

anthnich

  • Newbie
  • *
  • Posts: 34
    • View Profile
    • Long Division LLC
Re: Fixing OS X 10.10 CMake "built for unsupported file format" Errors
« Reply #4 on: November 03, 2014, 08:33:24 pm »
https://github.com/SFML/SFML - Download ZIP. Extract.

Went ahead and redownloaded it. Double click to unzip. Wouldn't you know it, it worked! That was a first, never had a zip problem like that before. Wonder what could cause the symlink problem from a zip?

Thanks a lot for your posts and my apologies about jumping the gun, solution wise.

Another question: if /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype is a symlink to freetype.framework/Versions/A/freetype, why would linking directly to freetype.framework/Versions/A/freetype cause any harm?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Fixing OS X 10.10 CMake "built for unsupported file format" Errors
« Reply #5 on: November 03, 2014, 08:38:53 pm »
I guess it's a quirk in the unzipper or a corrupt download.. anyway, good to know it works now for you.

Quote
Another question: if /Users/x/Documents/SFML-master/SFML-master/extlibs/libs-osx/Frameworks/freetype.framework/freetype is a symlink to freetype.framework/Versions/A/freetype, why would linking directly to freetype.framework/Versions/A/freetype cause any harm?
You might be able to put your app on the AppStore. Honestly I don't know if there's other issue with it but since it's not the standard way of doing it I'd avoid it.
SFML / OS X developer

 

anything