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

Author Topic: CSFML cmake broken?  (Read 32145 times)

0 Members and 1 Guest are viewing this topic.

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #30 on: June 03, 2014, 06:26:57 pm »
Since CSFML is a static library, it doesn't link anything. So you have to link CSFML and SFML in the final binary (SFML.Net).

Hmm. I'm confused. I thought CSFML was self-containing SFML? Why do I need to link SFML also then? Anyway, after also linking libsfml-window-s.a and libsfml-graphics-s.a, libfreetype.a and libjpeg.a with mtouch i get a GL related error.

Undefined symbols for architecture i386:
  "sf::ThreadLocal::setValue(void*)", referenced from:
      sf::priv::GlContext::globalInit() in libsfml-window-s.a(GlContext.o)
      sf::priv::GlContext::initialize() in libsfml-window-s.a(GlContext.o)
      sf::priv::GlContext::setActive(bool) in libsfml-window-s.a(GlContext.o)
      sf::priv::GlContext::ensureContext() in libsfml-window-s.a(GlContext.o)
      (anonymous namespace)::getInternalContext() in libsfml-window-s.a(GlContext.o)
      sf::priv::GlContext::create() in libsfml-window-s.a(GlContext.o)
      sf::priv::GlContext::create(sf::ContextSettings const&, sf::priv::WindowImpl const*, unsigned int) in libsfml-window-s.a(GlContext.o)


I've verified that OpenGLES.framework is linked in.

myl

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #31 on: June 03, 2014, 08:19:00 pm »
Quote
I thought CSFML was self-containing SFML?
Not if it is compiled statically. A static library is simply an archive of compiled files, it can't link to any external library; linking must be done when building a binary (a shared library or an executable).

Quote
i get a GL related error.
I wouldn't call "sf::ThreadLocal::setValue" a GL function ;)
You must link to sfml-system.
Laurent Gomila - SFML developer

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #32 on: June 04, 2014, 02:59:51 pm »
Ok. I've tried to simplify things by only linking in libcsfml-window, libsfml-window-s and libsfml-system.s. These should work fine together by themselves, right?

To get through build errors I've also linked in QuartzCore.framework, CoreMotion.framework and OpenGLES.framework. I now get consistent errors when building for Simulator (i386) or when building for iOS device (armv7). It looks like one for every p invoke (41) in sfmlnet-window:
Undefined symbols for architecture armv7:
  "_sfJoystick_getAxisPosition", referenced from:
     -u command line option

(The above error says "for architecture i386" for simulator builds). Full build command and errors: http://pastebin.com/ZS3J5ZqN

I've verified the 3 linked in sfml libs are the correct archs (i386 or armv7) by using lipo like this:
xcrun -sdk iphoneos lipo -info CSFMLiOS/lib/Release/libcsfml-system.a
Architectures in the fat file: CSFMLiOS/lib/Release/libcsfml-system.a are: armv7 armv7s arm64


The funny thing is, if I build without linking in libsfml-window, I get errors like
Undefined symbols for architecture armv7:
  "sf::Mouse::getPosition(sf::Window const&)", referenced from:
      sfMouse_getPosition(sfWindow const*) in libcsfml-window.a(Mouse.o)

Meaning sfMouse_getPosition and the rest actually was located in libcsfml-window.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #33 on: June 04, 2014, 03:06:29 pm »
What is this "-u" command line option?
Laurent Gomila - SFML developer

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #34 on: June 04, 2014, 03:23:01 pm »
From http://linux.die.net/man/1/clang:

-Umacroname
Adds an implicit #undef into the predefines buffer which is read before the source file is preprocessed.


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #35 on: June 04, 2014, 03:38:27 pm »
I'm not sure, but I don't think -U is the same as -u. And why is it used in your project?
Laurent Gomila - SFML developer

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #36 on: June 04, 2014, 03:45:48 pm »
I'm not sure, but I don't think -U is the same as -u. And why is it used in your project?
Hah, I was wondering the same, but haven't found a better match yet :) The compile options for clang++ are generated by mtouch, which is the xamarin mono compiler/linker.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #37 on: June 04, 2014, 03:55:11 pm »
This forum discussion seems like it could be helpful.
Laurent Gomila - SFML developer

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #38 on: June 04, 2014, 04:55:53 pm »
This forum discussion seems like it could be helpful.

Thx Laurent. I'll look into it! Sorry for google proxying you :)

myl

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #39 on: June 09, 2014, 10:15:33 am »
I've tried to merge  libcsfml-window, libsfml-window-s and libsfml-system.s together using libtool to see if the mtouch compiler likes it better to be fed a single lib instead of three, and then I got an interesting error:

libtool libsfml-system-s.a libsfml-window-s.a ../../../CSFMLiOS/lib/Release/libcsfml-window.a -o fatlibcsfml-window.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (Context.o) in output file used for input files: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(Context.o) and: libsfml-window-s.a(Context.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (Joystick.o) in output file used for input files: libsfml-window-s.a(Joystick.o) and: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(Joystick.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (Keyboard.o) in output file used for input files: libsfml-window-s.a(Keyboard.o) and: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(Keyboard.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (Mouse.o) in output file used for input files: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(Mouse.o) and: libsfml-window-s.a(Mouse.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (VideoMode.o) in output file used for input files: libsfml-window-s.a(VideoMode.o) and: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(VideoMode.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (Window.o) in output file used for input files: libsfml-window-s.a(Window.o) and: ../../../CSFMLiOS/lib/Release/libcsfml-window.a(Window.o) due to use of basename, truncation and blank padding

So this would explain why mtouch linking fails if it's attempting something like this. What would be the best way to go about these naming clash issues? Is there perhaps a setting in CSFML XCode project that will allow me to include SFML in the CSFML libraries?

myl

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #40 on: June 10, 2014, 03:05:22 pm »
Ok, it turns out that the libcsfml-window.a i'm trying to link with is missing the C externs, and that is what is making mtouch complain.
nm command for iOS built libcsfml-window:
http://pastebin.com/Tzvv0uZA
Compared to OSX built libcsfml-window.dylib:
http://pastebin.com/73ajMtUN

I'm looking to get definitions like
T _sfWindow_createUnicode

Any ideas how to make CSFML build for iOS with the usual externs?

myl

myl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • Email
Re: CSFML cmake broken?
« Reply #41 on: June 18, 2014, 12:33:55 pm »
Hey Laurent (and anybody else down with CSFML).

Bump. Anybody got any ideas why the C externs are missing?

myl

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #42 on: June 18, 2014, 01:01:47 pm »
Nop, sorry.
Laurent Gomila - SFML developer

rcurtis

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: CSFML cmake broken?
« Reply #43 on: September 25, 2014, 04:48:04 pm »
Has this issue been resolved yet?  I've been trying to configure CSFML with CMake on Windows for a the past half hour and it never seems to find the SFML libs it is interested in.  I have to manually tell it where to find the SFML dependencies (glew, freetype, etc...) and even after that it blows up with:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindSFML.cmake:344 (message):
  Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
  SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY SFML_AUDIO_LIBRARY)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:26 (find_package)
 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CSFML cmake broken?
« Reply #44 on: September 25, 2014, 05:01:47 pm »
Are you sure this is the same issue? Which version of SFML / CSFML are you compiling?
Laurent Gomila - SFML developer