Closed jaredonline closed 9 years ago
Hey there!
Unfortunately I do not have access to a mac(though I really should for testing purposes), but I will definitely look into this and help you out. I have a couple of things you could try that might help to pin point what's going on. Not much, but it's a start.
Hope that helps! Let me know what happens.
I built SFML 2.0 by hand and it worked just fine. I'm unable to get CSFML to build. It looks like the same set of errors. Should I go bother them?
I was able to get CSFML to build now. Here's what I'm getting now:
[jared@Adam-Smith DSFML-C-clang (master)]$ make
Scanning dependencies of target dsfml-system
[ 2%] Building CXX object src/SFML/System/CMakeFiles/dsfml-system.dir/Clock.cpp.o
[ 5%] Building CXX object src/SFML/System/CMakeFiles/dsfml-system.dir/Err.cpp.o
Linking CXX shared library ../../../lib/libdsfml-system.dylib
[ 5%] Built target dsfml-system
Scanning dependencies of target dsfml-window
[ 7%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Context.cpp.o
[ 10%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Err.cpp.o
[ 12%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Joystick.cpp.o
[ 15%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Keyboard.cpp.o
[ 17%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Mouse.cpp.o
[ 20%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/VideoMode.cpp.o
[ 23%] Building CXX object src/SFML/Window/CMakeFiles/dsfml-window.dir/Window.cpp.o
Linking CXX shared library ../../../lib/libdsfml-window.dylib
[ 23%] Built target dsfml-window
Scanning dependencies of target dsfml-network
[ 25%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/Err.cpp.o
[ 28%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/Ftp.cpp.o
[ 30%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/Http.cpp.o
[ 33%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/IpAddress.cpp.o
[ 35%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/Packet.cpp.o
[ 38%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/SocketSelector.cpp.o
[ 41%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/TcpListener.cpp.o
[ 43%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/TcpSocket.cpp.o
[ 46%] Building CXX object src/SFML/Network/CMakeFiles/dsfml-network.dir/UdpSocket.cpp.o
Linking CXX shared library ../../../lib/libdsfml-network.dylib
[ 46%] Built target dsfml-network
Scanning dependencies of target dsfml-graphics
[ 48%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Err.cpp.o
[ 51%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Font.cpp.o
[ 53%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Image.cpp.o
[ 56%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/RenderTexture.cpp.o
[ 58%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/RenderWindow.cpp.o
[ 61%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Shader.cpp.o
[ 64%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Texture.cpp.o
[ 66%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/Transform.cpp.o
[ 69%] Building CXX object src/SFML/Graphics/CMakeFiles/dsfml-graphics.dir/View.cpp.o
Linking CXX shared library ../../../lib/libdsfml-graphics.dylib
[ 69%] Built target dsfml-graphics
Scanning dependencies of target dsfml-audio
[ 71%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/ALCheck.cpp.o
[ 74%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/AudioDevice.cpp.o
[ 76%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/Err.cpp.o
[ 79%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/Listener.cpp.o
[ 82%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/Sound.cpp.o
[ 84%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/SoundBuffer.cpp.o
[ 87%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/sfSoundFile.cpp.o
[ 89%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/SoundFile.cpp.o
[ 92%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/InternalSoundRecorder.cpp.o
[ 94%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/SoundRecorder.cpp.o
[ 97%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/SoundSource.cpp.o
[100%] Building CXX object src/SFML/Audio/CMakeFiles/dsfml-audio.dir/SoundStream.cpp.o
Linking CXX shared library ../../../lib/libdsfml-audio.dylib
Undefined symbols for architecture x86_64:
"_alBufferData", referenced from:
_sfSoundBuffer_fillBuffer in SoundBuffer.cpp.o
_sfSoundStream_fillBuffer in SoundStream.cpp.o
"_alDeleteBuffers", referenced from:
_sfSoundBuffer_alDeleteBuffer in SoundBuffer.cpp.o
_sfSoundStream_deleteBuffers in SoundStream.cpp.o
"_alDeleteSources", referenced from:
_sfSoundSource_destroy in SoundSource.cpp.o
"_alGenBuffers", referenced from:
_sfSoundBuffer_alGenBuffers in SoundBuffer.cpp.o
_sfSoundStream_alGenBuffers in SoundStream.cpp.o
(maybe you meant: _sfSoundStream_alGenBuffers, _sfSoundBuffer_alGenBuffers )
"_alGenSources", referenced from:
_sfSoundSource_initialize in SoundSource.cpp.o
"_alGetBufferi", referenced from:
_sfSoundBuffer_getSampleRate in SoundBuffer.cpp.o
_sfSoundBuffer_getChannelCount in SoundBuffer.cpp.o
_sfSoundStream_getBufferSampleSize in SoundStream.cpp.o
"_alGetEnumValue", referenced from:
sf::priv::AudioDevice::getFormatFromChannelCount(unsigned int) in AudioDevice.cpp.o
"_alGetError", referenced from:
sf::priv::alCheckError(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in ALCheck.cpp.o
"_alGetSource3f", referenced from:
_sfSoundSource_getPosition in SoundSource.cpp.o
"_alGetSourcef", referenced from:
_sfSound_getPlayingOffset in Sound.cpp.o
_sfSoundSource_getPitch in SoundSource.cpp.o
_sfSoundSource_getVolume in SoundSource.cpp.o
_sfSoundSource_getMinDistance in SoundSource.cpp.o
_sfSoundSource_getAttenuation in SoundSource.cpp.o
_sfSoundStream_getPlayingOffset in SoundStream.cpp.o
"_alGetSourcei", referenced from:
_sfSound_getLoop in Sound.cpp.o
_sfSoundSource_isRelativeToListener in SoundSource.cpp.o
_sfSoundSource_getStatus in SoundSource.cpp.o
_sfSoundStream_clearQueue in SoundStream.cpp.o
_sfSoundStream_getNumberOfBuffersProccessed in SoundStream.cpp.o
"_alIsExtensionPresent", referenced from:
sf::priv::AudioDevice::isExtensionSupported(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in AudioDevice.cpp.o
"_alSource3f", referenced from:
_sfSoundSource_setPosition in SoundSource.cpp.o
"_alSourcePause", referenced from:
_sfSoundStream_alSourcePause in SoundStream.cpp.o
(maybe you meant: _sfSoundStream_alSourcePause)
"_alSourcePlay", referenced from:
_sfSoundStream_alSourcePlay in SoundStream.cpp.o
(maybe you meant: _sfSoundStream_alSourcePlay)
"_alSourceQueueBuffers", referenced from:
_sfSoundStream_queueBuffer in SoundStream.cpp.o
"_alSourceStop", referenced from:
_sfSoundStream_alSourceStop in SoundStream.cpp.o
(maybe you meant: _sfSoundStream_alSourceStop)
"_alSourceUnqueueBuffers", referenced from:
_sfSoundStream_clearQueue in SoundStream.cpp.o
_sfSoundStream_UnqueueBuffer in SoundStream.cpp.o
"_alSourcef", referenced from:
_sfSound_setPlayingOffset in Sound.cpp.o
_sfSoundSource_setPitch in SoundSource.cpp.o
_sfSoundSource_setVolume in SoundSource.cpp.o
_sfSoundSource_setMinDistance in SoundSource.cpp.o
_sfSoundSource_setAttenuation in SoundSource.cpp.o
"_alSourcei", referenced from:
_sfSound_assignBuffer in Sound.cpp.o
_sfSound_detachBuffer in Sound.cpp.o
_sfSound_setLoop in Sound.cpp.o
_sfSoundSource_initialize in SoundSource.cpp.o
_sfSoundSource_setRelativeToListener in SoundSource.cpp.o
_sfSoundSource_destroy in SoundSource.cpp.o
_sfSoundStream_deleteBuffers in SoundStream.cpp.o
...
"_alcCaptureCloseDevice", referenced from:
InternalSoundRecorder::closeDevice() in InternalSoundRecorder.cpp.o
"_alcCaptureOpenDevice", referenced from:
InternalSoundRecorder::initialize(unsigned int) in InternalSoundRecorder.cpp.o
"_alcCaptureSamples", referenced from:
InternalSoundRecorder::getSamplePointer(int) in InternalSoundRecorder.cpp.o
"_alcCaptureStart", referenced from:
InternalSoundRecorder::startCapture() in InternalSoundRecorder.cpp.o
"_alcCaptureStop", referenced from:
InternalSoundRecorder::stopCapture() in InternalSoundRecorder.cpp.o
"_alcCloseDevice", referenced from:
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
"_alcCreateContext", referenced from:
sf::priv::AudioDevice::AudioDevice() in AudioDevice.cpp.o
"_alcDestroyContext", referenced from:
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
"_alcGetIntegerv", referenced from:
InternalSoundRecorder::getSampleNumber() in InternalSoundRecorder.cpp.o
"_alcIsExtensionPresent", referenced from:
sf::priv::AudioDevice::isExtensionSupported(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in AudioDevice.cpp.o
"_alcMakeContextCurrent", referenced from:
sf::priv::AudioDevice::AudioDevice() in AudioDevice.cpp.o
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
sf::priv::AudioDevice::~AudioDevice() in AudioDevice.cpp.o
"_alcOpenDevice", referenced from:
sf::priv::AudioDevice::AudioDevice() in AudioDevice.cpp.o
"_sf_close", referenced from:
sf::priv::SoundFile::~SoundFile() in SoundFile.cpp.o
sf::priv::SoundFile::~SoundFile() in SoundFile.cpp.o
sf::priv::SoundFile::openRead(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in SoundFile.cpp.o
sf::priv::SoundFile::openRead(void const*, unsigned long) in SoundFile.cpp.o
sf::priv::SoundFile::openRead(sf::InputStream&) in SoundFile.cpp.o
sf::priv::SoundFile::openWrite(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, unsigned int) in SoundFile.cpp.o
"_sf_open", referenced from:
sf::priv::SoundFile::openRead(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in SoundFile.cpp.o
sf::priv::SoundFile::openWrite(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, unsigned int) in SoundFile.cpp.o
"_sf_open_virtual", referenced from:
sf::priv::SoundFile::openRead(void const*, unsigned long) in SoundFile.cpp.o
sf::priv::SoundFile::openRead(sf::InputStream&) in SoundFile.cpp.o
"_sf_read_short", referenced from:
sf::priv::SoundFile::read(short*, unsigned long) in SoundFile.cpp.o
"_sf_seek", referenced from:
sf::priv::SoundFile::seek(sf::Time) in SoundFile.cpp.o
"_sf_strerror", referenced from:
sf::priv::SoundFile::openRead(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in SoundFile.cpp.o
sf::priv::SoundFile::openRead(void const*, unsigned long) in SoundFile.cpp.o
sf::priv::SoundFile::openRead(sf::InputStream&) in SoundFile.cpp.o
sf::priv::SoundFile::openWrite(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, unsigned int) in SoundFile.cpp.o
"_sf_write_short", referenced from:
sf::priv::SoundFile::write(short const*, unsigned long) in SoundFile.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libdsfml-audio.2.0.dylib] Error 1
make[1]: *** [src/SFML/Audio/CMakeFiles/dsfml-audio.dir/all] Error 2
make: *** [all] Error 2
What did you do to get the other stuff building? Just curious.
This looks like something I can fix, but I might need you to do the testing since I don't have a Mac. It seems like OpenAL and libsndfile aren't being linked, which is strange considering CMake was able to find them. Since this is a high priority issue it'll take precedence over my other stuff. Hopefully I can get a fix out for you soon!
Also, it looks like everything except the audio module was built. It is inconvenient for sure, but at least you can start using the other parts of the binding until I can sort the audio part out. Feel free to open up an issue for any other problems you might encounter!
So I deleted the .dylib
and .framework
files that were installed in /usr/local/lib
and /Library
related to SFML. Then I deleted all my source files (SFML, CSFML, DSFML-C) and started from scratch. SFML and CSFML built fine, but I got the above error when trying to build DSFML-C.
But now I'm getting all the same errors no matter what I try to build, so I have no idea what's going on. I'm willing to help out any way I can [=
I just tried that same strategy to build DSFML-C and now I'm back to the original error. libdsfml-system.dylib
builds, but nothing else.
Wow. This is crazy. I'll do what I can to help you, but with out a Mac of my own I'm worried there's not much that I can do. Try to not lose hope though! I have Saturday off, and tomorrow morning free. I've also decided that I'll be getting an extra HDD and getting OS X up and running on my own machine.
For now, it might be a good idea to post in the D section of the SFML forums with a title that specifies problems with OS X. Hiura, SFML's OS X guy, has posted in there before when I has some Mac issues. It's possible he might have some answers or suggestions.
Okay! I figured something out. When I got CSFML to build, I must have accidentally built it against Dynamic Libraries of SFML-2.0, not static ones (.dylib
instead of .a
).
Doing the same thing with DSFML-C gets me able to build everything but the audio lib.
Does that mean you'd need to include both the SFML .dylibs and the DSFML .dylibs if you wanted to build anything with DSFML?
As far as I know, CSFML is supposed to use the static version library when it builds, so DSFML-C should be the same. I would post in the C section of the SFML forums and just verify this. Laurent or someone else might be able to help you out and we can get some answers.
I have a post up in the C section of the SFML forums. I'll post in the D section as well.
Cool. I saw both of them. Let's hope we get something!
By the way, thanks for being patient and helping me track this down!
I should be thanking you for putting this binding together and helping me get everything resolved! It looks like my post in teh D section of the forums was deleted ]=
Laurent says there was a recent major modification to the static build of CSFML which is untested on Mac. This is most likely causing the issues. I'll keep you posted if I find out more.
I saw that! I wonder what happened. Maybe it was deleted because it was a duplicate post? I didn't have a chance to read it so I don't know.
Looks like your update shows some promise though. The actual modification wasn't really in CSFML, it was to the way SFML static libraries are now built. Before it would gather all dependencies for you in some crazy way I don't understand, but now you need to specify those during the link process, and that's what broke things. You can read more about it in this thread if you want.
There's something I've been considering that would fix this, but it would involve linking our D program to the SFML dynamic libraries, the DSFML-C libraries, and the D DSFML libraries. It would work, but could be a little annoying setting a project up.
Hey, I've been following that thread all day, it's what helped me make some of the progress I've made. But now I'm a bit stuck.. it looks like it's looking for OpenAL headers, but all I see is the include .dll
... I don't think that'll work for a Mac, will it?
Okay, I got it. OpenAL is a framework that ships with Mac OS X.
That was the last hurdle! They both built! DSFML- C, DSFML, and CSFML all build.
But now there's a new problem:
(I'm using dub
, I don't know if that's good or bad [did I mention I'm brand new to D?])
app.d
import std.stdio;
import mapping.map;
import dsfml.graphics.all;
void main()
{
}
package.json
{
"name": "dgame",
"description": "An example project skeleton",
"homepage": "http://example.org",
"copyright": "Copyright © 2000, Your Name",
"authors": [
"Your Name"
],
"dependencies": {
},
"dflags": [
"-I/Users/jared/src/DSFML/src/",
"-L+/Users/jared/src/DSFML-C Builds/clang/lib/",
"-L+/Users/jared/src/DSFML/lib/"
]
}
Output:
[jared@Adam-Smith DGame (master)]$ dub -v
Using dub registry url 'http://code.dlang.org/'
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /Users/jared/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /Users/jared/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /Users/jared/.dub/packages/
Looking for local package map at /var/lib/dub/packages/
Looking for local package map at /Users/jared/.dub/packages/
Failed to run git: git rev-parse failed: fatal: Not a git repository: '/Users/jared/Code/DGame/.git'
Note: Failed to determine version of package dgame at /Users/jared/Code/DGame. Assuming ~master.
Collecting dependencies for dgame
Checking dependencies in '/Users/jared/Code/DGame'
dub initialized
Generating using build
Using config application for dgame
Using config application for dgame
Building configuration "application", build type debug
Application output name is '/tmp/dub/2226245526/dgame'
Running dmd (compile)...
dmd -I/Users/jared/src/DSFML/src/ -L+/Users/jared/src/DSFML-C Builds/clang/lib/ -L+/Users/jared/src/DSFML/lib/ -w -g -debug -c -of/tmp/dub/2226245526/temp.o -version=Have_dgame -I/Users/jared/Code/DGame/source -J/Users/jared/Code/DGame/views source/app.d source/mapping/generator.d source/mapping/map.d source/mapping/tile.d
Linking...
dmd -of/tmp/dub/2226245526/dgame /tmp/dub/2226245526/temp.o -g
Undefined symbols for architecture x86_64:
"_D5dsfml8graphics3all12__ModuleInfoZ", referenced from:
_D3app12__ModuleInfoZ in temp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
Error: Link command failed with exit code 1
Full exception: object.Exception@source/dub/compilers/dmd.d(120): Link command failed with exit code 1
----------------
5 dub 0x0000000102639657 pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) + 107
6 dub 0x00000001026230ff void dub.compilers.dmd.DmdCompiler.invokeLinker(const(dub.compilers.compiler.BuildSettings), const(dub.compilers.compiler.BuildPlatform), immutable(char)[][]) + 987
7 dub 0x0000000102626f05 void dub.generators.build.BuildGenerator.generateProject(dub.generators.generator.GeneratorSettings) + 4897
8 dub 0x00000001025ff2e4 void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) + 160
9 dub 0x00000001025f3fbd _Dmain + 6333
10 dub 0x00000001026dc951 extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain() + 33
11 dub 0x00000001026dc49d extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate()) + 45
12 dub 0x00000001026dc99d extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll() + 61
13 dub 0x00000001026dc49d extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate()) + 45
14 dub 0x00000001026dc451 _d_run_main + 457
15 dub 0x00000001026dc280 main + 20
16 libdyld.dylib 0x00007fff909dc5fd start + 1
17 ??? 0x0000000000000002 0x0 + 2
Run 'dub help' for usage information.
[jared@Adam-Smith DGame (master)]$
I'm not terribly familiar with dub, but I will be trying to put in a dub file for DSFML in the near future. It looks like you are correctly setting up your link paths, but your dependency list is blank so you aren't actually linking to any of the libraries themselves.
Judging from their docs, it looks like the dependencies
section is supposed to be be for other Dub packages? I'm not sure http://code.dlang.org/package-format
One thing, in your example, you have a bunch of files like dsfml-system-2.lib
but I don't have those anywhere (that I can find). I have libdsfml-system.a
Yep, that's why I need to get a dub file made :P
The dsfml-xxx-2.lib are just for windows. They're import libraries. In your case, you'll be linking to the dsfml-xxx-2.dylibs instead. The libdsfml-xxx.a files will be replacing the dsfml-xxx.lib files in the tutorial. If you give me a sec, I can write out what the command line should look like as an example if you want.
That'd be awesome. My head is swimming with all this stuff right now [=
This is what I was just trying:
dmd main.d libdsfml-window.dylib libdsfml-graphics.dylib libdsfml-system.dylib -I/Users/jared/src/DSFML/src/ -L+/Users/jared/src/DSFML-C-Builds/clang/lib/ -L+/Users/jared/src/DSFML/lib/
Error: unrecognized file extension dylib
Soooo I think I got the command right, but now I'm getting undefined symbol issues:
dmd main.d -I/Users/jared/src/DSFML/src/ -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-L/Users/jared/src/DSFML/lib/ -L-ldsfml-system -L-ldsfml-window -L-ldsfml-graphics -g
Undefined symbols for architecture x86_64:
"_D5dsfml6system7vector214__T7Vector2TfZ7Vector26__ctorMFNaNbNcNfffZS5dsfml6system7vector214__T7Vector2TfZ7Vector2", referenced from:
__Dmain in main.o
"_D5dsfml6system7vector214__T7Vector2TfZ7Vector26__initZ", referenced from:
__Dmain in main.o
"_D5dsfml6window15contextsettings15ContextSettings7DefaultxS5dsfml6window15contextsettings15ContextSettings", referenced from:
__Dmain in main.o
"_D5dsfml6window5event5Event6__initZ", referenced from:
__Dmain in main.o
"_D5dsfml6window9videomode9VideoMode6__ctorMFNckkkZS5dsfml6window9videomode9VideoMode", referenced from:
__Dmain in main.o
"_D5dsfml8graphics11circleshape11CircleShape6__ctorMFfkZC5dsfml8graphics11circleshape11CircleShape", referenced from:
__Dmain in main.o
"_D5dsfml8graphics11circleshape11CircleShape7__ClassZ", referenced from:
__Dmain in main.o
"_D5dsfml8graphics12renderstates12RenderStates7DefaultFZS5dsfml8graphics12renderstates12RenderStates", referenced from:
__Dmain in main.o
"_D5dsfml8graphics12renderwindow12RenderWindow6__ctorMFS5dsfml6window9videomode9VideoModeAyaE5dsfml6window6window6Window5StyleKxS5dsfml6window15contextsettings15ContextSettingsZC5dsfml8graphics12renderwindow12RenderWindow", referenced from:
__Dmain in main.o
"_D5dsfml8graphics12renderwindow12RenderWindow7__ClassZ", referenced from:
__Dmain in main.o
"_D5dsfml8graphics14rectangleshape14RectangleShape6__ctorMFS5dsfml6system7vector214__T7Vector2TfZ7Vector2ZC5dsfml8graphics14rectangleshape14RectangleShape", referenced from:
__Dmain in main.o
"_D5dsfml8graphics14rectangleshape14RectangleShape7__ClassZ", referenced from:
__Dmain in main.o
"_D5dsfml8graphics3all12__ModuleInfoZ", referenced from:
_D4main12__ModuleInfoZ in main.o
"_D5dsfml8graphics5color5Color3RedyS5dsfml8graphics5color5Color", referenced from:
__Dmain in main.o
"_D5dsfml8graphics5color5Color4BlueyS5dsfml8graphics5color5Color", referenced from:
__Dmain in main.o
"_D5dsfml8graphics5color5Color5BlackyS5dsfml8graphics5color5Color", referenced from:
__Dmain in main.o
"_D5dsfml8graphics5color5Color5GreenyS5dsfml8graphics5color5Color", referenced from:
__Dmain in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
I'll have to update the tutorial for OS X because it is a little different. Looks like you almost had it. You just need to link with both sets of libs.
Try this:
dmd main.d libdsfml-system.a libdsfml-window.a libdsfml-graphics.a -I/Users/jared/src/DSFML/src/ -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-L/Users/jared/src/DSFML/lib/ -L-lcsfml-system -L-ldsfml-window -L-lcsfml-graphics -g
Now I'm getting:
dmd main.d libdsfml-system.a libdsfml-window.a libdsfml-graphics.a -I/Users/jared/src/DSFML/src/ -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-L/Users/jared/src/DSFML/lib/ -L-lcsfml-system -L-ldsfml-window -L-lcsfml-graphics -g
clang: error: no such file or directory: 'libdsfml-system.a'
clang: error: no such file or directory: 'libdsfml-window.a'
clang: error: no such file or directory: 'libdsfml-graphics.a'
Hmm.. Assuming libdsfml-system.a, libdsfml-window.a, and libdsfml-graphics.a are in your /Users/jared/src/DSFML/lib/ directory, that should work.
Also, there was a typo in the command line I posted. it used -L-lcsfml-system
but it should be -L-ldsfml-system
Yea, I fixed the typo... trying to work out the source issues. Yea, the files are in /Users/jared/src/DSFML/lib/
So the .a
files should be linked during the link phase, right? Not compiled during the dmd
compile phase?
Putting in the fully qualified path I get
dmd main.d /Users/jared/src/DSFML/lib/libdsfml-system.a /Users/jared/src/DSFML/lib/libdsfml-graphics.a -L/Users/jared/src/DSFML/lib/ -I/Users/jared/src/DSFML/src/ -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-ldsfml-system -L-ldsfml-window -L-ldsfml-graphics -g
ld: can't map file, errno=22 file '/Users/jared/src/DSFML/lib/' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
Also... I'm missing libdsfml-window.a
Re: missing libdsfml-window.a
:
rdmd build.d
You're about to build DSFML! Go you!
Building for OSX
Building system module.
Building audio module.
Building network module.
Building window module.
Building graphics module.
Done!
[jared@Adam-Smith DSFML (master)]$ ll lib
total 5304
drwxr-xr-x 6 jared staff 204B Nov 8 17:43 .
drwxr-xr-x 8 jared staff 272B Nov 8 17:43 ..
-rw-r--r-- 1 jared staff 702K Nov 8 20:21 libdsfml-audio.a
-rw-r--r-- 1 jared staff 869K Nov 8 20:21 libdsfml-graphics.a
-rw-r--r-- 1 jared staff 556K Nov 8 20:21 libdsfml-network.a
-rw-r--r-- 1 jared staff 514K Nov 8 20:21 libdsfml-system.a
Sorry to keep spamming you.
I think I've gotten to the point where I'm just missing libdsfml-window.a
:
dmd main.d /Users/jared/src/DSFML/lib/libdsfml-system.a /Users/jared/src/DSFML/lib/libdsfml-graphics.a -I/Users/jared/src/DSFML/src/ -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-ldsfml-system -L-ldsfml-window -L-ldsfml-graphics -g
Undefined symbols for architecture x86_64:
"_D5dsfml6window15contextsettings15ContextSettings6__initZ", referenced from:
_D5dsfml8graphics12renderwindow12RenderWindow11getSettingsMxFZS5dsfml6window15contextsettings15ContextSettings in libdsfml-graphics.a(renderwindow_285_4d8.o)
"_D5dsfml6window15contextsettings15ContextSettings7DefaultxS5dsfml6window15contextsettings15ContextSettings", referenced from:
__Dmain in main.o
"_D5dsfml6window3all12__ModuleInfoZ", referenced from:
_D5dsfml8graphics3all12__ModuleInfoZ in libdsfml-graphics.a(all.o)
"_D5dsfml6window5event5Event6__initZ", referenced from:
__Dmain in main.o
"_D5dsfml6window6window12__ModuleInfoZ", referenced from:
_D5dsfml8graphics12renderwindow12__ModuleInfoZ in libdsfml-graphics.a(renderwindow.o)
_D5dsfml8graphics7texture12__ModuleInfoZ in libdsfml-graphics.a(texture.o)
"_D5dsfml6window6window6Window16getWindowPointerFC5dsfml6window6window6WindowZPv", referenced from:
_D5dsfml8graphics12renderwindow12RenderWindow12getWindowPtrMFC5dsfml6window6window6WindowZPv in libdsfml-graphics.a(renderwindow_285_4d8.o)
_D5dsfml8graphics12renderwindow12RenderWindow13windowPointerFC5dsfml6window6window6WindowZPv in libdsfml-graphics.a(renderwindow_285_4d8.o)
"_D5dsfml6window6window6Window6__ctorMFZC5dsfml6window6window6Window", referenced from:
_D5dsfml8graphics12renderwindow12RenderWindow6__ctorMFZC5dsfml8graphics12renderwindow12RenderWindow in libdsfml-graphics.a(renderwindow_285_4d8.o)
_D5dsfml8graphics12renderwindow12RenderWindow6__ctorMFS5dsfml6window9videomode9VideoModeAyaE5dsfml6window6window6Window5StyleKxS5dsfml6window15contextsettings15ContextSettingsZC5dsfml8graphics12renderwindow12RenderWindow in libdsfml-graphics.a(renderwindow_285_4d8.o)
_D5dsfml8graphics12renderwindow12RenderWindow6__ctorMFS5dsfml6window9videomode9VideoModeAywE5dsfml6window6window6Window5StyleKxS5dsfml6window15contextsettings15ContextSettingsZC5dsfml8graphics12renderwindow12RenderWindow in libdsfml-graphics.a(renderwindow_285_4d8.o)
_D5dsfml8graphics12renderwindow12RenderWindow6__ctorMFmKxS5dsfml6window15contextsettings15ContextSettingsZC5dsfml8graphics12renderwindow12RenderWindow in libdsfml-graphics.a(renderwindow_285_4d8.o)
"_D5dsfml6window6window6Window7__ClassZ", referenced from:
_D5dsfml8graphics12renderwindow12RenderWindow7__ClassZ in libdsfml-graphics.a(renderwindow_285_4d8.o)
"_D5dsfml6window9videomode12__ModuleInfoZ", referenced from:
_D5dsfml8graphics12renderwindow12__ModuleInfoZ in libdsfml-graphics.a(renderwindow.o)
"_D5dsfml6window9videomode9VideoMode6__ctorMFNckkkZS5dsfml6window9videomode9VideoMode", referenced from:
__Dmain in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1
Trying to build the window
module by hand I'm getting:
dmd src/dsfml/window/all.d src/dsfml/window/context.d src/dsfml/window/contextsettings.d src/dsfml/window/event.d src/dsfml/window/joystick.d src/dsfml/window/keyboard.d src/dsfml/window/mouse.d src/dsfml/window/videomode.d src/dsfml/window/window.d src/dsfml/window/windowhandle.d -lib -O -release -inline -property -I/Users/jared/src/DSFML/src -of/Users/jared/src/DSFML/lib/libdsfml-window.a
src/dsfml/window/mouse.d(74): Error: mutable method dsfml.window.window.Window.mouse_SetPosition is not callable using a const object`
I caught that the other day, but it looks like I only fixed that in RenderWindow.
In window.d, if you add const
to the end of setMousePosition(line 227) and mouse_setPosition(line 232) you shouldn't get that error anymore.
It compiled!!! But!
./main
dyld: Library not loaded: libdsfml-system.2.dylib
Referenced from: /Users/jared/Desktop/./main
Reason: image not found
Trace/BPT trap: 5
I tried this:
dmd main.d /Users/jared/src/DSFML/lib/libdsfml-system.a \
> /Users/jared/src/DSFML/lib/libdsfml-window.a \
> /Users/jared/src/DSFML/lib/libdsfml-graphics.a \
> -I/Users/jared/src/DSFML/src/ \
> -L-L/Users/jared/src/DSFML-C-Builds/clang/lib/ -L-ldsfml-system.2 \
> -L-ldsfml-window.2 -L-ldsfml-graphics.2 -L-ldsfml-system \
> -L-ldsfml-window -L-ldsfml-graphics -g
But that didn't help.
One. Step. At. A. Time ]=
BAM!!!
IT WORKED!
I had to follow instructions from http://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-loaded
Yay!
Thank you so so so much for all the patience and help. I'll write up some formal instructions for your Wiki if you'd like? Or some troubleshooting tips.
That's awesome! I'm happy you were able to get it working!
If it's not too much trouble, if you could make a copy of the current build tutorial and add in all the parts that are OS X specific, I'll go through it later and turn it in to a Mac only tutorial. It was my plan to split them up into a tutorial for each OS eventually, but it looks like one for OS X specifically now is much needed. Alternatively, you could email me a walk through of what you did, and I can make the separate tutorial myself. Either one is fine by me.
The other thing you could do for me is make a pull request for all of the CMake files you changed. Fixing those means no one else will have the same build errors you had in the beginning. I'm certain Laurent would appreciate you doing the same for CSFML too.
I should be the one to thank you! You did most of the work. Much appreciated!
I was looking at some mac stuff, and although I can't test it yet, I had a question that maybe you can answer for me.
It looks like that when you build DSFML-C, you get a couple of sets of dylibs. dsfml-xxx.dylib, dsfml-xxx.2.dylib, and dsfml.2.0.dylib, right? From what I can tell, dsfml-xxx.dylib just routs things to dsfml-xxx.2.dylib, which in turn routs things to dsfml-xxx.2.0.dylib. The dsfml-xxx.2.0.dylib seems to be the "real" dynamic library, so I'm not sure why the others exists. Is it possible to just link directly to the dsfml-xxx.2.0.dylibs?
Also, did you ever figure out why you had to put in the full path to your D static libraries in order to get it to find them? I feel like there should be an easier way than to put in the full path for each one. Maybe a different linker flag I'm not aware of?
Hey @Jebbs, didn't get any time over the weekend to look, but I'll try this week.
I'll totally put in pull requests for the wiki, and for the DSFML-C CMakeLists file (and probably for the CSFML ones too).
I'll take a look into the many .dylib
files that are generated and which ones I need to be linking to.
I haven't figured out what the deal with the full paths is yet, also looking into that.
The last thing I'm doing is trying to figure out how to get DUB to build teh project successfully. Lots of investigating going on [=
No worries! Someone else contacted me about getting the DUB stuff up and running, so I was going to see if I could get that up and running tomorrow. I don't use DUB, but it looks like its getting even more popular, so I figured I might as well get it soon. For now, don't stress too much about getting the DUB stuff done.
Thanks so much for all your help!
My pleasure to help!
If you'd like, I can share with you my learnings about DUB. As far as I can tell, it splits compilation into two steps. First, it compiles (without linking) into a temp file, in /tmp/dub/#{timestamp}/#{executable}.o
. This command is passed only the DUB compile flags (listed in the "dflags"
attribute of package.json
). Next, the linking happens as a separate command, and is only passed the linked flags.
Both commands look correct, but when I run them (outside of DUB), I get errors. If I combine them into a single step, it compiles just fine.
I've added my notes to the Wiki for building DSFML-C, I'll update it again with the compilation instructions.
Is there any way you can do a pull request for the alerted cmake file? I think that would be easier for the Mac users.
I'm actually pretty unfamiliar with CMake, and didn't make any changes to the file directly. Wanna help me get it setup?
Oh, interesting. Looks like I just misunderstood the section you wrote. I don't know CMake too well, but I might be able to get it to the point where you can see what I am going for and could maybe finish it out. I pretty much just copied over everything from CSFML and played around with it until it worked :P
I have tomorrow off, so I'll let you know if I think I have anything!
Cool! Just so you know, I have a thread open on the DUB forums about my issues: http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/509/
Hey @Jebbs, just wanted to check in and see if there's anything I can do to push this forward.
Thanks for checking in!
I was working on wrapping up another project of mine so that I could focus on DSFML before I start my planning for the SFML Game Jam, but I got to a good stopping point yesterday so DSFML has my full attention now. :)
For getting DSFML-C to build for OSX, I was planning on going through SFML's CMake files for information on how it does things. It should really be pretty similar to the way it builds the shared libraries in terms of scanning for and grabbing all dependencies. I'll be able to check it out today or tomorrow, so expect an update on that soon. I hope to have something that can be tested in the next couple of days.
Relating to the DUB stuff, I added a temp DUB package.json that should be ready enough by the end of the day for testing. Never used DUB before, so I don't know how long that will take, but you can also expect an update on that very soon.
More updates!
I'm looking in to the library name thing. I think the reason you needed the full path to your static libs is relevant to the issue.(check out #68) Because of this, the DUB file won't be ready until tomorrow, but I think you won't have the error you experienced in that post you linked to any longer.
Also, it looks like Laurent did some updates for CSFML's CMake files so that might take longer than I originally thought to get those looked into. I need to make sure we have everything we need when they build dynamically.
Updates!
Haven't had a chance to take care of the cmake stuff yet, but I'm almost there.
The DUB package.json is just about ready, I'm just getting a few couple of things finished up. I have my own thread on the DUB forums, and Sönke Ludwig has been helping me out as well. Shouldn't be much longer.
About the static library issue, I updated a few things in the wiki and in the build script. When you run the build script, it produces libraries named libdsfml-xxx-2.a, the -2 prefix being new so that the names are different from the dylibs. Adding the path to the static libs to the linker like before, you should now be able to link to them the same way as the dylibs: -L-ldsfml-xxx-2
.
More update!
I was successful in getting dub to build a DSFML application. Changes have been uploaded, but I'll do a short tutorial tomorrow!
Forgot to let you know about this, but I did add a tutorial to the wiki. You can find it here: https://github.com/Jebbs/DSFML/wiki/Building-The-Library-And-Your-First-DSFML-Program%28DUB-Edition!%29
Let me know what you think!
My next project is to update parts of the wiki to make it better, and split up the tutorials for each OS. That shoudl make following them a little easier. :)
I also wanted to say that I am working on getting OSX up and running on a VM. I hope to be able to have things working and building soon so hopefully we can have easier building all around. You'll know if I make progress there!
Hey! Sorry I've been so unresponsive. Slammed at work right now.
I'm excited to try out the new DUB package stuff and see if I can get it to work =D
Let me know if you need any help testing things for OS X. I'll be digging into all this in more detail soon I hope... either tonight or tomorrow.
Hey there... I tried following the tutorial (including building my static libraries from SFML by hand), but am running into the following.
Configuration works fine. Generating the Makefile works fine. Here's my CMake setup:
And here's what I hit with bash:
Any help would be had [=