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

Author Topic: [Solved] OSx Yosemite: x86_64 symbols problem  (Read 4367 times)

0 Members and 2 Guests are viewing this topic.

Sir_Rai

  • Newbie
  • *
  • Posts: 2
    • View Profile
[Solved] OSx Yosemite: x86_64 symbols problem
« on: December 28, 2014, 09:09:12 am »
I'm using OSx Yosemite (10.10.1) with x86_64 architecture. I just cloned the sfml project from github and compiled it successfully, even the examples provided in the repo. But when I try to compile the tutorial test with the green circle:

(click to show/hide)


I have this error:
Code: [Select]
$ clang++ main.cpp -lsfml-graphics                         
Undefined symbols for architecture x86_64:
  "sf::String::String(char const*, std::__1::locale const&)", referenced from:
      _main in main-16f53e.o
  "sf::Window::close()", referenced from:
      _main in main-16f53e.o
  "sf::Window::display()", referenced from:
      _main in main-16f53e.o
  "sf::Window::pollEvent(sf::Event&)", referenced from:
      _main in main-16f53e.o
  "sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
      _main in main-16f53e.o
  "sf::Window::isOpen() const", referenced from:
      _main in main-16f53e.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I used ccmake to build SFML with shared libraries (not the framework thing). Following the tutorial I use clang and the c++11 libs. For the architecture I have placed "i386;x86_64" this is the CMakeCache generated and the configuration. (This is a bit long click spoiler to see)

(click to show/hide)

Checking the libs in /usr/local/lib with file command I see every lib from SFML is universal. Here the output for libsfml-graphics lib:

$ file libsfml-graphics.dylib                  
libsfml-graphics.dylib: Mach-O universal binary with 2 architectures
libsfml-graphics.dylib (for architecture i386): Mach-O dynamically linked shared library i386
libsfml-graphics.dylib (for architecture x86_64):       Mach-O 64-bit dynamically linked shared library x86_64


my clang version:
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

I have read multiples posts and googling during hours reading about this issue, most of them related with a wrong configuration in cmake or a bad sfml version download. Most people on osx are using xcode (Im not) and the framework solution, but I want to build just shared libs. I'm doing something wrong? I'm new using clang maybe I'm not compiling the main in a proper way. I've tried compiling using  "-std=c++11" "-stdlib=libc++" as arguments with the same results. Any idea guys?

« Last Edit: December 28, 2014, 06:44:03 pm by Sir_Rai »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: OSx Yosemite: x86_64 symbols problem
« Reply #1 on: December 28, 2014, 09:28:07 am »
$ clang++ main.cpp -lsfml-graphics
should be
$ clang++ main.cpp -lsfml-graphics  -lsfml-window -lsfml-system
;)

If you don't want to use Xcode, have a go with the Linux tutorial. There might be some insight there. http://www.sfml-dev.org/tutorials/2.2/start-linux.php
SFML / OS X developer

Sir_Rai

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: OSx Yosemite: x86_64 symbols problem
« Reply #2 on: December 28, 2014, 04:10:02 pm »
omg it was the problem! <Facepalm> Thank you Hiura  :)