SFML community forums

Bindings - other languages => DotNet => Topic started by: farnoy on August 14, 2011, 08:23:23 pm

Title: Using edge version on linux
Post by: farnoy on August 14, 2011, 08:23:23 pm
Hi,

I was using SFML 2.0 with C++, but now i wanted to change for C#. I'm using mono and I've compiled SFML.Net with Tao framework. I've copied csfml-window lib at version 1.99.git20110616-1 with command:

Code: [Select]
cp /usr/lib/libcsfml-window.so ./libcsfml-window-2.so

Following output appears:

Code: [Select]
Mono: DllImport attempting to load: 'csfml-window-2'.
Mono: DllImport loading library: '/home/kuba/devel/SFML.Net/examples/window/libcsfml-window-2'.
Mono: Searching for 'sfWindow_Create'.
Mono: Probing 'sfWindow_Create'.
Mono: Found as 'sfWindow_Create'.
mono: symbol lookup error: /home/kuba/devel/SFML.Net/examples/window/libcsfml-window-2: undefined symbol: _ZNK2sf6Window8GetInputEv


I don't know where to go from now. Using libraries for windows doesn't seem reasonable and I would bet on version differences. Isn't SFML.Net edge aiming 2.0?
Title: Using edge version on linux
Post by: Laurent on August 14, 2011, 11:18:54 pm
I don't know if Mono wants Linux shared libraries or Windows DLLs. Try to recompile CSFML for Linux, and replace the CSFML DLLs with it.
Title: Using edge version on linux
Post by: farnoy on August 14, 2011, 11:31:32 pm
It's loading csfml, but fails to find something inside, so what csfml version is SFML.Net targeting?
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 10:37:21 am
Quote
It's loading csfml

Are you sure? The lib is not named libcsfml-window-2.

Quote
so what csfml version is SFML.Net targeting?

The one which is provided in its exlibs directory.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 11:42:26 am
Code: [Select]
/usr/lib/libcsfml-window.so => /usr/lib/libcsfml-window.so.2 => /usr/lib/libcsfml-window.so.2.0

I'll try to recompile edge version of CSFML, the one I have is from 16th June, maybe something changes from that date.
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 02:58:10 pm
Yeah... This is one that you compiled yourself, SFML.Net is supposed to use the latest version of SFML (I always keep them synchronized).
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 05:06:11 pm
I can't compile CSFML:

Code: [Select]
kuba:CSFML$ make
Found SFML: /usr/include
-- Configuring done
CMake Error at cmake/Macros.cmake:58 (add_library):
  Cannot find source file:

    /home/kuba/devel/CSFML/src/SFML/Graphics/RenderImage.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
Call Stack (most recent call first):
  src/SFML/Graphics/CMakeLists.txt:44 (csfml_add_library)


It would look like there's old SFML CMakeLists.txt and new files (not RenderImage, but RenderTexture), when I rename files in CMakeLists to use those texture files it fails with:

Code: [Select]
In file included from /home/kuba/devel/CSFML/src/SFML/Graphics/FontStruct.h:32:0,
                 from /home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:29:
/home/kuba/devel/CSFML/src/SFML/Graphics/TextureStruct.h:31:37: fatal error: SFML/Graphics/Texture.hpp: No such file or directory
compilation terminated.
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 07:03:05 pm
Sorry, a file was outdated. It's fixed now.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 07:09:01 pm
Pulled your changes, but I'm still getting similar error:

Code: [Select]
[ 51%] Building CXX object src/SFML/Graphics/CMakeFiles/csfml-graphics.dir/Font.cpp.o
In file included from /home/kuba/devel/CSFML/src/SFML/Graphics/FontStruct.h:32:0,
                 from /home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:29:
/home/kuba/devel/CSFML/src/SFML/Graphics/TextureStruct.h:31:37: fatal error: SFML/Graphics/Texture.hpp: No such file or directory
compilation terminated.


Edit:

And then when I copy Texture.hpp to CSFML/src/SFML/Graphics I get this:

Code: [Select]
/home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp: In function ‘const sfTexture* sfFont_GetTexture(sfFont*, unsigned int)’:
/home/kuba/devel/CSFML/src/SFML/Graphics/Font.cpp:154:54: error: ‘class sf::Font’ has no member named ‘GetTexture’


Are you changing spec for 2.0 with deleting GetTexture() from sf::Font? If so, documentation is not refreshed and I think and bindings are outdated. http://www.sfml-dev.org/documentation/2.0/classsf_1_1Font.php#a0879bdd56d69b22fb93d0948150e0d10

Edit2:

Seems like developing using unstable bindings won't work here, but there are no tags on git for earlier version, like 1.6.
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 07:26:30 pm
Now it's your version of SFML which is not up-to-date.

Bindings are stable, just pull the latest revision of everything.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 07:30:49 pm
The Texture.hpp header is up to date from git. Is CSFML using SFML from /usr/include (installed on system)?
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 07:32:59 pm
Quote
The Texture.hpp header is up to date from git

How can it be up-to-date, the compiler doesn't even find it?

Quote
Is CSFML using SFML from /usr/include (installed on system)?

Yes.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 07:34:54 pm
Texture.hpp wast taken from git repo of SFML.
So the issue lies in outdated sfml on my system (28th July).
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 07:37:45 pm
Yup, everything is working fine now, only when building audio binding in CSFML:
Code: [Select]
In file included from /home/kuba/devel/CSFML/src/SFML/Audio/SoundRecorder.cpp:28:0:
/home/kuba/devel/CSFML/include/SFML/Audio/SoundRecorder.h:36:66: error: ‘size_t’ has not been declared


I don't need audio lib atm so I'll try with SFML.Net now.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 07:40:35 pm
Working fine, thanks for your help. Now I don't have to worry about C++.
Title: Using edge version on linux
Post by: farnoy on August 15, 2011, 10:09:00 pm
Scratch that, something's wrong again with simple test:

Code: [Select]
       static void Main()
        {
RenderWindow window = new RenderWindow(new VideoMode(800, 600, 32), "SFML.Net Window", Styles.Default, new ContextSettings(32, 32, 16, 0, 1));

Sprite circleSprite = new Sprite(new Texture(@"content\circleSprite.png"));

while (window.IsOpened())
            {
window.Clear(new Color(0, 0, 0));
window.Draw(circleSprite);
window.Display();
}
        }


Output:

Code: [Select]
/usr/bin/mono: symbol lookup error: /home/kuba/devel/galaxier/galaxier/bin/Debug/libcsfml-graphics-2.so: undefined symbol: _ZN2sf7TextureC1Ev

Similar happens when trying to run shader demo:

Code: [Select]
mono: symbol lookup error: /home/kuba/devel/sfml/SFML.Net/examples/shader/libcsfml-graphics-2.so: undefined symbol: _ZN2sf13RenderTextureC1Ev

I'll just use the 1.6 version until 2.0 becomes stable
Title: Using edge version on linux
Post by: Laurent on August 15, 2011, 10:37:29 pm
It is stable, you just fail to build/configure/use the whole thing properly ;)

From the error messages, I'd say that you're using CSFML libraries from an older revision (without the sf::Texture class).
Title: Using edge version on linux
Post by: farnoy on August 16, 2011, 11:07:05 am
I'm building and installing SFML, then CSFML and then SFML.Net, everything is compiled from newest sources. I checked csfml-graphics with `nm` and it shows about 10 undefined symbols. Something's using Window.GetInput() but it's no longer present in CSFML, because you replaced it with Keyboard, Joystick classes (as far as I know).
Title: Using edge version on linux
Post by: Laurent on August 16, 2011, 11:19:27 am
There's nothing in CSFML sources that's still using the old sf::Input class. I noticed that Input.h is still there (I'll remove it as soon as I come home), but it only contains functions declarations, no code calling sf::Input.
Title: Using edge version on linux
Post by: Laurent on August 16, 2011, 11:25:58 am
Can you tell me where those undefined functions are called in the source code? So that we can see if it's your version which is outdated, or me being totally blind :)
Title: Using edge version on linux
Post by: farnoy on August 16, 2011, 11:36:17 am
It's working again... I just copied the same things to MonoDevelop project, but there's this: yesterday I flagged csfml package as out-of-date, today this package has been updated to newest available, so I know what was wrong.

SFML.Net used CSFML from the same dir, but also used SFML from system? I don't know what the update did, because I manually installed SFML before this update, but it's fine now and I won't touch this again until 3.0.

Maybe I should've done `make install --prefix /usr`, but I'm not sure at this point. Anyway, thanks for the help.