zyedidia / SFML.jl

A binding of the game and multimedia library SFML for Julia
Other
93 stars 22 forks source link

CSFML Libraries on Windows #5

Closed foresterre closed 9 years ago

foresterre commented 9 years ago

I would like to note a small issue I had while trying to use this package (after building), on the Windows operating system (It did not occur for me on Debian Linux).

I took the following steps using Julia v0.4.0-dev on a Jupyter notebook:

The package itself can be imported, without any errors:

using SFML

My first error occurred with the following code:

rec = SoundBufferRecorder()
LoadError: error compiling call: could not load library "libcsfml-audio"
The specified module could not be found.

while loading In[3], in expression starting on line 1

Here after I added the builded csml DLL's explicitly to my Windows environment. While running the same code as above from the command line:

julia sound_test.jl
PS D:\dev\tmp> julia .\test_sound.jl

WARNING: deprecated syntax "Ptr{Void} (" at C:\Users\Foresterre\.julia\v0.4\SFML\src\julia/Network/udpSocket.jl:12.
Use "Ptr{Void}(" instead.
ERROR: LoadError: error compiling call: could not load library "libcsfml-audio"
The specified module could not be found.

 in include at boot.jl:259
 in include_from_node1 at loading.jl:267
 in process_options at client.jl:308
 in _start at client.jl:411
while loading D:\dev\tmp\test_sound.jl, in expression starting on line 3

Both times libcsfml-audio could not be found on the system. The reason for this is because the SFML DLL's on Windows are build and named in the following format: sfml--2.dll or in the case of csfml csfml--2 (e.g. csfml-graphics-2).

I solved it for my install by copying & renaming the DLL's (from the format: csfml--2.dll formatting to libcsfml-.dll) from

C:\Users\Foresterre\.julia\v0.4\SFML\deps\sfml-binaries\csfml\csfml-32\bin

to

C:\Users\Foresterre\.julia\v0.4\SFML\deps\
zyedidia commented 9 years ago

Thanks for reporting the issue.

Unfortunately I do not have access to a Windows computer at the moment. However, I think I know how to fix the error, if you say that renaming the DLL's worked for you. I have pushed a fix to master. Please Pkg.clone it and let me know if it works.

See commit e771c762239d954a2292687773edcc69cf86afe3

foresterre commented 9 years ago

I'm not sure why, but this is the result with the current master:

WARNING: module SFML should explicitly import * from Base
WARNING: module SFML should explicitly import + from Base
WARNING: module SFML should explicitly import - from Base
WARNING: module SFML should explicitly import / from Base
Something has gone wrong with the SFML installation. Please rebuild.

However, the program (I've used your "recorder.jl" from your JuliaCon-SFML repository for this testing purpose), does compile and run correctly.

As a side note: The warning from the previous commit does not appear.

WARNING: deprecated syntax "Ptr{Void} (" at C:\Users\Foresterre\.julia\v0.4\SFML\src\julia/Network/udpSocket.jl:12.
Use "Ptr{Void}(" instead.
zyedidia commented 9 years ago

Ok, I'll have to take a look later when I have a Windows computer at hand. For now, I have fixed the warnings with a new commit, but I am not sure why it thinks something has gone wrong with the installation. Try making sure the deps/ directory is empty before running Pkg.build.

foresterre commented 9 years ago

I've just cloned and rebuild the package and explicitly checked that the deps/ directory is empty (except for the build.jl). The warnings are indeed gone as expected; All julia programs in the examples/Audio directory run fine, except for Something has gone wrong with the SFML installation. Please rebuild.

The programs in the examples/Graphics folder however do not run with the current commit.

PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics> julia .\line.jl
omething has gone wrong with the SFML installation. Please rebuild.
RROR: LoadError: error compiling call: could not load library "libjuliasfml"
1 is not a valid Win32 application.

in include at boot.jl:259
in include_from_node1 at loading.jl:267
in process_options at client.jl:308
in _start at client.jl:411
hile loading C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics\line.jl, in expression starting on line 4

I've checked these (examples/Graphics) also against the latest version in METADATA.jl. Without renaming the DLL's as mentioned above I get the same error as the one above.

With copying and renaming the DLL's as described above I only get the warning on the latest METADATA.jl version, and every program in the examples/* directory works for me as expected.

WARNING: deprecated syntax "Ptr{Void} (" at C:\Users\Foresterre\.julia\v0.4\SFML\src\julia/Network/udpSocket.jl:12.
Use "Ptr{Void}(" instead.
zyedidia commented 9 years ago

Ok, I now fully understand the issue. I hope my latest commit finally fixes the it: the DLL's are now only renamed after libjuliasfml has been built. If the problems persist, I think I'll just have to wait until I can get a Windows computer.

That deprecated syntax warning has also been fixed since 0.0.8.

foresterre commented 9 years ago

I've cloned and build the update, with the following results:

PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Audio> julia .\music.jl
Something has gone wrong with the SFML installation. Please rebuild.
Music is 29.12653 seconds long
Press 'p' to pause and resume
Press escape to quit
PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Audio> cd ..
PS C:\Users\Foresterre\.julia\v0.4\SFML\examples> cd .\Graphics

PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics> julia .\line.jl
Something has gone wrong with the SFML installation. Please rebuild.
ERROR: LoadError: error compiling call: could not load library "libjuliasfml"
The specified module could not be found.

 in include at boot.jl:259
 in include_from_node1 at loading.jl:267
 in process_options at client.jl:308
 in _start at client.jl:411
while loading C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics\line.jl, in expression starting on line 4
PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics> julia .\camera.jl
Something has gone wrong with the SFML installation. Please rebuild.
ERROR: LoadError: error compiling call: could not load library "libjuliasfml"
The specified module could not be found.

 in include at boot.jl:259
 in include_from_node1 at loading.jl:267
 in process_options at client.jl:308
 in _start at client.jl:411
while loading C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics\camera.jl, in expression starting on line 8
PS C:\Users\Foresterre\.julia\v0.4\SFML\examples\Graphics>
PS C:\Users\Martijn\.julia\v0.4\SFML\examples\Network> julia .\http.jl
Something has gone wrong with the SFML installation. Please rebuild.
Success!
Got:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Learn (SFML)</title>
        <meta http-equiv="Content-Type" content="text/html"/>
        <meta charset="utf-8"/>
        <link rel="icon" type="image/ico" href="//www.sfml-dev.org/images/favicon.ico"/>
        <link rel='stylesheet' type='text/css' href="//fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>
        <link rel="stylesheet" type="text/css" href="//www.sfml-dev.org/styles/style.css" title="default" media="screen,
print"/>
        <link rel="stylesheet" type="text/css" href="//www.sfml-dev.org/scripts/highlight/styles/github.css"/>
        <!--[if (gte IE 9)|!(IE)]>
<!-->
        <script type="text/javascript" src="//www.sfml-dev.org/scripts/highlight/highlight.pack.js"></script>
        <script type="text/javascript">hljs.initHighlightingOnLoad();</script>
<!--<![endif]-->
    </head>
    <body id="top">
        <script type="text/javascript">
        ( and so on ...)

Thus, it seems like the issue persists. I've honestly no clue what is going on, but I greatly appreciate you're looking into the issue, thus thank you.

zyedidia commented 9 years ago

I got my hands on a Windows computer and have fixed this bug (at least, it was working for me from a fresh build). Please let me know if the issue is resolved.

foresterre commented 9 years ago

Great! Everything seems to be working now. Thanks for the fixes.

aforren1 commented 8 years ago

I've run into a similar issue with the more recent builds of SFML.jl, but only for the audio library. This is Julia 0.4.0 (2015-10-08 release), SFML.jl up to date with master as of 10/28/2015, and Windows 10.

All of the graphics and network examples seem to work fine, eg:

C:\Users\aforr_000\.julia\v0.4\SFML\examples>julia Graphics/line.jl
(SFML.Vector2f(400.0f0,300.0f0),SFML.Vector2f(5.0000916f0,4.9999084f0))
10.0

On the other hand,

C:\Users\aforr_000\.julia\v0.4\SFML\examples>julia Audio/music.jl
ERROR: LoadError: error compiling call: could not load library "csfml-audio-2"
The specified module could not be found.

 in include at boot.jl:261
 in include_from_node1 at loading.jl:304
 in process_options at client.jl:308
 in _start at client.jl:411
while loading C:\Users\aforr_000\.julia\v0.4\SFML\examples\Audio\music.jl, in ex
pression starting on line 3

The csfml-audio-2.dll is in /SFML/deps/, and nothing looks obviously different (to me) in how csfml-audio-2 is treated compared to system-2, etc. in src/SFML.jl. Any ideas? And thank you for the work you've put into this package!

zyedidia commented 8 years ago

My best guess is that SFML 2.2 does not support Windows 10 too well, because SFML 2.2 came out before Windows 10 (and is now on to SFML 2.3). I've been considering upgrading SFML.jl to use SFML 2.3, but haven't gotten around to it. The audio works fine on my Windows 7 computer and unfortunately I don't have access to a Windows 10 computer. If you want to test this out yourself, you could try downloading SFML 2.2 and 2.3 (the C++ versions) and seeing if one of them breaks when trying to run audio.

aforren1 commented 8 years ago

Thanks! I'll try to give it a whirl tomorrow.