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

Author Topic: [FIXED] Setting up SFML on OS X Yosemite / Xcode 6 - clang error  (Read 4229 times)

0 Members and 1 Guest are viewing this topic.

SKIN

  • Newbie
  • *
  • Posts: 5
    • View Profile
[FIXED] Setting up SFML on OS X Yosemite / Xcode 6 - clang error
« on: November 02, 2014, 04:34:53 pm »
Hi,

I am trying to set up SFML on Xcode for the first time on my newly updated machine.

Everything has been done exactly as per this tutorial: http://www.sfml-dev.org/tutorials/2.0/start-osx.php

Next to that I also installed the Templates download as I read from this topic: http://en.sfml-dev.org/forums/index.php?topic=16395.0

After having done this and trying to run the SFML App basic application inside Xcode I get these errors:

clang: error: unknown argument: '-frameworksfml-system'
clang: error: unknown argument: '-frameworksfml-window'
clang: error: unknown argument: '-frameworksfml-graphics'
clang: error: unknown argument: '-frameworksfml-audio'
clang: error: unknown argument: '-frameworksfml-network'

I also see that the necessary files aren't being copied over to the project folder as the file main.cpp seems to suggest:
// Note that the "Run Script" build phase will copy the required frameworks
// or dylibs to your application bundle so you can execute it on any OS X
// computer.

Should I copy over the files in the project folder? If so which folder inside the project folder?

Anyone have any ideas or hints?

These are the files I downloaded and installed/copied over to the necessary folders on my Mac machine as per the tutorial:

Clang - universal 32+64 bits (OS X 10.8+, compatible with C++11 and libc++)
Templates for Xcode 5
« Last Edit: November 02, 2014, 07:04:01 pm by SKIN »

SKIN

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Setting up SFML on OS X Yosemite / Xcode 6
« Reply #1 on: November 02, 2014, 04:51:56 pm »
Interesting, I just set up a 2nd Test project after trying some other things, but I'm pretty sure all those things were related to my first project only (trying to copy frameworks files there etc) but somehow I am getting different run errors with my 2nd test project:

ld: file too small (length=0) file '/usr/local/lib/libsfml-window.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: file too small (length=0) file '/Library/Frameworks/sfml-system.framework/sfml-system' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am documenting this hoping to fix it, but if someone can chime in that would of course be greatly appreciated.

EDIT:

I think I know why I am getting other errors, in the first project I tried to add them manually to the Linked Frameworks And Libraries section of the project in Xcode.

EDIT2:

No I don't think that's it, I added them manually to the second project too but still these above errors and not the ones from the OP

EDIT3:

Redone everything from the Install SFML section on this page manually: http://www.sfml-dev.org/tutorials/2.0/start-osx.php

I did do the install.sh scripts but they didn't seem to copy everything over as how the manual way suggests it so I did the manual way instead, make sure everything is there.

I start another new project, the project is a SFML App with C++ Compiler and Standard Library set to "C++11 with Clang and libc++ libraries", architecture set to "Universal" and SFML binaries set to "Frameworks".

I try to run/build I get these 2 errors:

ld: file too small (length=0) file '/Library/Frameworks/sfml-window.framework/sfml-window' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
------
ld: file too small (length=0) file '/usr/local/lib/libsfml-window.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

OK I try to link them inside the "Linked Frameworks and Libraries" section in the General settings for the app

I add:

libc++.dylib

The SFML ones in the 'Frameworks' folder that aren't listed in the actual panel so I add them via "Add Other.." from a folder on my desktop from which I copied the files from.

SFML ones have a little chest/lock icon and libc++.dylib has a white shield icon.

I try to run/build the project again but failed with these errors:

ld: file too small (length=0) file '/Library/Frameworks/sfml-system.framework/sfml-system' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
----
ld: file too small (length=0) file '/Library/Frameworks/sfml-system.framework/sfml-system' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note how it is sfml-system now.. not sure what to try next, google doesn't suggest much on these.


« Last Edit: November 02, 2014, 05:36:51 pm by SKIN »

SKIN

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Setting up SFML on OS X Yosemite / Xcode 6
« Reply #2 on: November 02, 2014, 06:43:49 pm »
Another couple of tries I did was Clean and Clean Build Folder, as well as copying the framework files over to the project folder and adding them to the Build Phases. Still no luck.

SKIN

  • Newbie
  • *
  • Posts: 5
    • View Profile
[FIXED]Re: Setting up SFML on OS X Yosemite / Xcode 6 Clang errors
« Reply #3 on: November 02, 2014, 07:03:34 pm »
I fixed it!

Very strange, however in the Frameworks folder, for example

sfml-audio.framework the sfml-audio file is 0 bytes, but if you go in /Versions/2.1.0/ there is a sfml-audio file that isn't empty(177kb), I copied this to the root in sfml-audio.framework and did this for all of them it finally worked (after clean and clean build folder).

I did this on another clean project, that does not have the frameworks added in the project folder or in the Build Phases. Note that they are still not added to the project under /Frameworks/ as the screenshot in the tutorial suggests, but at least it works.

Anyone know why this happened? Took me a good few hours but.. finally there.

Source: http://stackoverflow.com/questions/15849991/ld-file-too-small-for-architecture-i386 (Bottom comment from nicola)
« Last Edit: November 02, 2014, 07:07:56 pm by SKIN »