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

Author Topic: Building SFML 2.1 under FreeBSD  (Read 6871 times)

0 Members and 1 Guest are viewing this topic.

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Building SFML 2.1 under FreeBSD
« on: October 30, 2013, 06:50:25 pm »
Hi,
With a few tweaks with the preprocessor directives and a dummy implementation of
Quote
src/SFML/Window/Linux/JoystickImpl
I managed to build SFML 2.1 under FreeBSD 9.2 stable amd64.
I also successfully ran one of the tutorial examples against the resulting libraries.

Unfortunately there is no easy way to use the Linux version of JoystickImpl because the linux-js port has been removed. It seems that the cleanest solution is to disable all joystick support on FreeBSD.

So the question is: Is there a clean way to disable joystick support when building SFML? If not, how much refactoring would be needed to introduce such an option?

10x

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #1 on: October 30, 2013, 06:54:31 pm »
FreeBSD is correctly supported (with joysticks) in the current sources. Compile them instead of version 2.1.
Laurent Gomila - SFML developer

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #2 on: October 30, 2013, 06:56:55 pm »
Is this something recent?
I have the sources from 22nd of October.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #3 on: October 30, 2013, 07:29:13 pm »
Laurent Gomila - SFML developer

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #4 on: October 30, 2013, 09:54:51 pm »
This is very cool :)
I'm able to build the latest code. However linking to the resulting libraries fails like this:
$ clang++ -I/home/mgp/tmp/SFML-cc3dc29ef42fbd6e3442a9d9ce000c9d52f2ee34/include -L/home/mgp/tmp/sfml2-head-build/lib -lsfml-window -lsfml-graphics -v -rpath /home/mgp/tmp/sfml2-head-build/lib -o w w.cc
FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610
Target: x86_64-unknown-freebsd9.2
Thread model: posix
 "/usr/bin/clang++" -cc1 -triple x86_64-unknown-freebsd9.2 -emit-obj -mrelax-all -disable-free -main-file-name w.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -v -resource-dir /usr/bin/../lib/clang/3.3 -I /home/mgp/tmp/SFML-cc3dc29ef42fbd6e3442a9d9ce000c9d52f2ee34/include -fdeprecated-macro -fdebug-compilation-dir /home/mgp/tmp/sfml2-head-build -ferror-limit 19 -fmessage-length 190 -mstackrealign -fobjc-runtime=gnustep -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o /tmp/w-nKu15Z.o -x c++ w.cc
clang -cc1 version 3.3 based upon LLVM 3.3 default target x86_64-unknown-freebsd9.2
ignoring nonexistent directory "/usr/include/c++/4.2/backward/backward"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.3/include"
ignoring duplicate directory "/usr/include/c++/4.2"
ignoring duplicate directory "/usr/include/c++/4.2/backward"
ignoring duplicate directory "/usr/include/c++/4.2/backward"
#include "..." search starts here:
#include <...> search starts here:
 /home/mgp/tmp/SFML-cc3dc29ef42fbd6e3442a9d9ce000c9d52f2ee34/include
 /usr/include/c++/4.2
 /usr/include/c++/4.2/backward
 /usr/include/clang/3.3
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o w /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/home/mgp/tmp/sfml2-head-build/lib -L/usr/lib -lsfml-window -lsfml-graphics -rpath /home/mgp/tmp/sfml2-head-build/lib /tmp/w-nKu15Z.o -lstdc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::getCapabilities() const'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `XRRConfigCurrentConfiguration'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::update()'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::isConnected(unsigned int)'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::close()'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `XRRSetScreenConfig'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::initialize()'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::cleanup()'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::open(unsigned int)'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `XRRFreeScreenConfigInfo'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `XRRGetScreenInfo'
/home/mgp/tmp/sfml2-head-build/lib/libsfml-window.so: undefined reference to `XRRConfigSizes'
 

Looks like the joystick stuff did not get built?

This is how I built SFML:
$ cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/clang++ -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_FLAGS="-stdlib=libstdc++" -D CMAKE_C_FLAGS="-stdlib=libstdc++ -std=c99" ../SFML-cc3dc29ef42fbd6e3442a9d9ce000c9d52f2ee34
-- The C compiler identification is Clang 3.3.0
-- The CXX compiler identification is Clang 3.3.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so
-- Looking for XOpenDisplay in /usr/local/lib/libX11.so;/usr/local/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/local/lib/libX11.so
-- Found OpenGL: /usr/local/lib/libGL.so  
-- Found Freetype: /usr/local/lib/libfreetype.so (found version "2.5.0")
-- Found GLEW: /usr/local/lib/libGLEW.so  
-- Found JPEG: /usr/local/lib/libjpeg.so  
-- Found OpenAL: /usr/local/lib/libopenal.so  
-- Found SNDFILE: /usr/local/lib/libsndfile.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mgp/tmp/sfml2-head-build
[mgp@home ~/tmp/sfml2-head-build]$ make
Scanning dependencies of target sfml-system
[  1%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.o
[  2%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.o
[  3%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Lock.cpp.o
[  5%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Mutex.cpp.o
[  6%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Sleep.cpp.o
[  7%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/String.cpp.o
[  9%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Thread.cpp.o
[ 10%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/ThreadLocal.cpp.o
[ 11%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Time.cpp.o
[ 13%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ClockImpl.cpp.o
[ 14%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/MutexImpl.cpp.o
[ 15%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/SleepImpl.cpp.o
[ 17%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadImpl.cpp.o
[ 18%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadLocalImpl.cpp.o
Linking CXX shared library ../../../lib/libsfml-system.so
[ 18%] Built target sfml-system
Scanning dependencies of target sfml-window
[ 19%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Context.cpp.o
[ 21%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.cpp.o
[ 22%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlResource.cpp.o
[ 23%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Joystick.cpp.o
[ 25%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/JoystickManager.cpp.o
[ 26%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Keyboard.cpp.o
[ 27%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Mouse.cpp.o
[ 28%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/VideoMode.cpp.o
[ 30%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Window.cpp.o
[ 31%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/WindowImpl.cpp.o
[ 32%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Unix/Display.cpp.o
[ 34%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Unix/GlxContext.cpp.o
[ 35%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Unix/InputImpl.cpp.o
[ 36%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Unix/VideoModeImpl.cpp.o
[ 38%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Unix/WindowImplX11.cpp.o
Linking CXX shared library ../../../lib/libsfml-window.so
[ 38%] Built target sfml-window
Scanning dependencies of target sfml-network
[ 39%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/Ftp.cpp.o
[ 40%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/Http.cpp.o
[ 42%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/IpAddress.cpp.o
[ 43%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/Packet.cpp.o
[ 44%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/Socket.cpp.o
[ 46%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/SocketSelector.cpp.o
[ 47%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/TcpListener.cpp.o
[ 48%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/TcpSocket.cpp.o
[ 50%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/UdpSocket.cpp.o
[ 51%] Building CXX object src/SFML/Network/CMakeFiles/sfml-network.dir/Unix/SocketImpl.cpp.o
Linking CXX shared library ../../../lib/libsfml-network.so
[ 51%] Built target sfml-network
Scanning dependencies of target sfml-graphics
[ 52%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Color.cpp.o
[ 53%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Font.cpp.o
[ 55%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/GLCheck.cpp.o
[ 56%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Image.cpp.o
[ 57%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/ImageLoader.cpp.o
[ 59%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderStates.cpp.o
[ 60%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTexture.cpp.o
[ 61%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTarget.cpp.o
[ 63%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderWindow.cpp.o
[ 64%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Shader.cpp.o
[ 65%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Texture.cpp.o
[ 67%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/TextureSaver.cpp.o
[ 68%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Transform.cpp.o
[ 69%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Transformable.cpp.o
[ 71%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/View.cpp.o
[ 72%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Vertex.cpp.o
[ 73%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Shape.cpp.o
[ 75%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/CircleShape.cpp.o
[ 76%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RectangleShape.cpp.o
[ 77%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/ConvexShape.cpp.o
[ 78%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Sprite.cpp.o
[ 80%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/Text.cpp.o
[ 81%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/VertexArray.cpp.o
[ 82%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImpl.cpp.o
[ 84%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImplFBO.cpp.o
[ 85%] Building CXX object src/SFML/Graphics/CMakeFiles/sfml-graphics.dir/RenderTextureImplDefault.cpp.o
Linking CXX shared library ../../../lib/libsfml-graphics.so
[ 85%] Built target sfml-graphics
Scanning dependencies of target sfml-audio
[ 86%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/ALCheck.cpp.o
[ 88%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/AudioDevice.cpp.o
[ 89%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/Listener.cpp.o
[ 90%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/Music.cpp.o
[ 92%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/Sound.cpp.o
[ 93%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundBuffer.cpp.o
[ 94%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundBufferRecorder.cpp.o
[ 96%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundFile.cpp.o
[ 97%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundRecorder.cpp.o
[ 98%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundSource.cpp.o
[100%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundStream.cpp.o
Linking CXX shared library ../../../lib/libsfml-audio.so
[100%] Built target sfml-audio

I don't see any output regarding the joystick.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #5 on: October 30, 2013, 10:32:53 pm »
Yep, it seems like something's wrong.

You should directly contact the author of the commit which added the FreeBSD support. See https://github.com/hftmarkand
Laurent Gomila - SFML developer

markand

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #6 on: October 31, 2013, 10:58:07 am »
Hi,

I don't know what you're doing but it really works for me (just git cloned right now and compiled)

I can see in your output that FreeBSD/JoystickImpl.cpp was not built. Do you correctly have the following at src/Window/CMakeLists.txt around line 73 ?

    elseif(SFML_OS_FREEBSD)
        set(PLATFORM_SRC
            ${PLATFORM_SRC}
            ${SRCROOT}/FreeBSD/JoystickImpl.cpp
            ${SRCROOT}/FreeBSD/JoystickImpl.hpp
        )  
    endif()
 

Could you add anywhere in the CMakeLists.txt something like :

message("OS = ${CMAKE_SYSTEM_NAME} and ${SFML_OS_FREEBSD}")
 

And rerun cmake to see the output ?

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #7 on: October 31, 2013, 12:13:55 pm »
Hi,
thanks for your answer.

Yes, I have that elseif statement you quoted.

I also added that line:
message("OS = ${CMAKE_SYSTEM_NAME} and ${SFML_OS_FREEBSD}")

and this is the output it produced:
OS = FreeBSD and

Apparently ${SFML_OS_FREEBSD} is undefined.
Does this mean something to you?

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #8 on: October 31, 2013, 12:37:59 pm »
I just cloned the git repo and I was able to build SFML (including the FreeBSD joystick) and link to the resulting libraries successfully.
Last time I did that I actually used the "Download ZIP" button in GitHub to obtain the code. Perhaps that zip didn't contain what I expected.
This is great. Thanks to all of you.

@Laurent, when will there be a new release?

@markand, are you working on a port?

markand

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #9 on: October 31, 2013, 06:14:13 pm »
Yes, I already created a port for 2.0 release but it has never been committed. I'll wait until the 2.2 release so we get full FreeBSD support and then I will send a new port again :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #10 on: October 31, 2013, 06:31:41 pm »
@Laurent, when will there be a new release?
Not any time in the next few month, given that SFML 2.2 should introduce Android and iOS support, which means switching to OpenGL ES etc. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #11 on: October 31, 2013, 06:43:51 pm »
Alright, thanks to all! :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Building SFML 2.1 under FreeBSD
« Reply #12 on: October 31, 2013, 08:32:42 pm »
Quote
Not any time in the next few month, given that SFML 2.2 should introduce Android and iOS support, which means switching to OpenGL ES etc.
And? Both ports are already finished (95%), OpenGL ES code is working.

The next release will most likely occur at the end of the year since this is the only moment when Marco is available to package the OS X stuff.
Laurent Gomila - SFML developer

mgp

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Building SFML 2.1 under FreeBSD
« Reply #13 on: October 31, 2013, 08:39:47 pm »
Great news!
We are looking forward to it!

 

anything