SFML community forums

Help => General => Topic started by: Ricky on February 21, 2013, 04:35:26 pm

Title: Another Mac Issue[SOLVED]
Post by: Ricky on February 21, 2013, 04:35:26 pm
Hello again,

I'm not able to build anything from Xcode  :D
I am using Xcode 4.5 and I built SFML using cmake unix makefiles
Did sudo make install in terminal, built SFML and copied it into directories.

Ok this is all well and good, example programs run just fine.

I open Xcode and make a new project; select SFML app as the template and that gets the skeleton program infront of me. Problem is I can't build it. The headers are located and the program will compile. The specific problem is it will not link.

I'm using the default compiler is Apple LLVM 4.1 and the standard lib. C++98 with Clang and libstdc++. SFML binaries is set to link the framework.

This is the output I get when I build
Quote
ld: warning: ld: warning: ignoring file /Library/Frameworks/sfml-graphics.framework/sfml-graphics, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /Library/Frameworks/sfml-graphics.framework/sfml-graphicsignoring file /Library/Frameworks/sfml-window.framework/sfml-window, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /Library/Frameworks/sfml-window.framework/sfml-window

ld: warning: ignoring file /Library/Frameworks/sfml-audio.framework/sfml-audio, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /Library/Frameworks/sfml-audio.framework/sfml-audio

ld: warning: ignoring file /Library/Frameworks/sfml-network.framework/sfml-network, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /Library/Frameworks/sfml-network.framework/sfml-network

ld: warning: ignoring file /Library/Frameworks/sfml-system.framework/sfml-system, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /Library/Frameworks/sfml-system.framework/sfml-system
After it ignores the frameworks I get a whole bunch of undefined references.

Any ideas? Thanks guys, I've been really trying hard to figure it out myself but I'm at my wits end  :D

-edit-

When I switch the architecture from "Standard (32/64-bit Intel) to Native I get a different set of errors but I only get 8

Quote
(null): -Wuninitialized is not supported without -O
  "_NSLog", referenced from:

  "_OBJC_CLASS_$_NSAutoreleasePool", referenced from:

  "_OBJC_CLASS_$_NSBundle", referenced from:

  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, sf::ContextSettings const&)", referenced from:

  "___CFConstantStringClassReference", referenced from:

  "_objc_msgSend", referenced from:

  "_objc_msgSend_fixup", referenced from:

-edit-

Issue solved. I'll be uploading snapshots of the steps I took to resolve the issues to help others.
Thanks again guys!
Title: Re: Another Mac Issue
Post by: Gan on February 21, 2013, 04:59:00 pm
I made a video on getting it SFML built and installed for mac:
http://www.youtube.com/watch?v=OyUb8bDP2mw&feature=youtu.be
Title: Re: Another Mac Issue
Post by: Ricky on February 21, 2013, 06:09:35 pm
I made a video on getting it SFML built and installed for mac:
http://www.youtube.com/watch?v=OyUb8bDP2mw&feature=youtu.be
I followed the tutorial to the letter and I got nothing. Same errors are coming up. Thanks for giving me something at least :)

-edit-

I tried rebuilding with default Xcode settings and now the only linking errors I get are
Quote
  "sf::Font::loadFromFile(std::string const&)", referenced from:

  "sf::Image::loadFromFile(std::string const&)", referenced from:

  "sf::Music::openFromFile(std::string const&)", referenced from:

  "sf::String::String(char const*, std::locale const&)", referenced from:

  "sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Title: Re: Another Mac Issue
Post by: Hiura on February 22, 2013, 10:30:43 am
I guess you're linking you app against libstdc++ but you build SFML with libc++ (or vice versa). The C++ lib must be an exact match or you'll get those errors.
Title: Re: Another Mac Issue
Post by: Ricky on February 22, 2013, 03:45:16 pm
I guess you're linking you app against libstdc++ but you build SFML with libc++ (or vice versa). The C++ lib must be an exact match or you'll get those errors.
You are right! That did the trick, Thanks again Hiura :)