digitalmars.D.learn - Derelict on Ubuntu with CODE::BLOCKS
- RegeleIONESCU (29/29) Dec 10 2017 Hello!
- Jordan Wilson (8/11) Dec 10 2017 I use Code::Blocks myself, but doesn't have inbuilt dub support.
- Mike Parker (84/106) Dec 10 2017 My advice is to ditch Code::Blocks and use something like VS Code
- RegeleIONESCU (16/28) May 02 2018 Hello every body!
- Mike Parker (8/16) May 02 2018 You an control that with precision, specifying specific versions
- RegeleIONESCU (60/78) May 03 2018 Hello!
- Mike Parker (23/36) May 03 2018 So your app is compiling and executing. This is a runtime error.
- RegeleIONESCU (6/15) May 04 2018 It works, even when loading all the libraries. I played with
Hello! Please help me install and use Derelict on Ubuntu 16.04! I saw this tutorial https://www.youtube.com/watch?v=exQ43PFWJBU and I wanted to do it in D but I got lost, totally lost. First step is to import OpenGL via Derelict. I am using Code::Blocks 16.01 with DMD. I downloaded all the archives from https://github.com/DerelictOrg. I tried to copy the folders into /usr/included/dmd, I tried and copied them to the lib folder, then I tried something with DUB - which says it needs a dub.sdl file although the file was right there beside it, in the same folder I run DUB from. I even tried to setup some paths in CB in project build options/debug/linker&search settings. I searched for tutorials but couldn't find one on how to install Derelict on Ubuntu. To make things even worse, I discovered that one needs not only to install Derelict but after that needs to install other libraries too that do not come with Derelict. I mention that I read Derelict documentation - but I get lost, things do not work at all and I am not used at all with linking, binding etc. Please tell me step by step how to make Derelict work with my Code::Blocks. I would like to make it system wide available, so that it is available for any project I make in CB. A little background on myself: I am a visual artist interested in programming. I used Python for a while, I did small projects, functional programming mainly, for example I made a small program that converts words into images. I learned C++ but never used it in real projects. I love D and I want to make all my future projects in D. Thank you!
Dec 10 2017
On Sunday, 10 December 2017 at 16:50:10 UTC, RegeleIONESCU wrote:Hello! Please help me install and use Derelict on Ubuntu 16.04! [...]I use Code::Blocks myself, but doesn't have inbuilt dub support. This link should help: http://derelictorg.github.io/building/without-dub/ This will tell you how to build the appropriate Derelict bindings. Note: you'll still need to make sure the actual C/C++ library your trying to use in your D project is available as well. Jordan
Dec 10 2017
On Sunday, 10 December 2017 at 16:50:10 UTC, RegeleIONESCU wrote:Hello! Please help me install and use Derelict on Ubuntu 16.04! I saw this tutorial https://www.youtube.com/watch?v=exQ43PFWJBU and I wanted to do it in D but I got lost, totally lost. First step is to import OpenGL via Derelict. I am using Code::Blocks 16.01 with DMD.My advice is to ditch Code::Blocks and use something like VS Code or Sublime Text in conjunction with DUB. It's by far the easiest way to get started with D, particularly for someone who as little practical experience with compilers and linkers. Then you don't have to worry about "installing" Derelict. You can get the Ubuntu packages for the C libraries you need via apt-get on Ubuntu, then use DUB to manage and build your project. Piece of cake compared to doing it all by hand. That said...I downloaded all the archives from https://github.com/DerelictOrg.What do you mean by "all"? You'll need DerelictUtil at minimum, as all the Derelict packages depend on it. Other than that, you only need the package that providing bindings to the C libraries you actually want to use -- DerelictGL3 to gain access to OpenGL for starters. Then, if you're using library like SDL or GLFW to create your OpenGL window, you'll want DerelictSDL2 or DerelictGLFW3 (not both).I tried to copy the folders into /usr/included/dmd, I tried and copied them to the lib folder, then I tried something with DUB - which says it needs a dub.sdl file although the file was right there beside it, in the same folder I run DUB from. I even tried to setup some paths in CB in project build options/debug/linker&search settings.For future reference, when asking for help like this, you'll need to be more specific about what you did and what errors you saw. This is too vague to be useful to anyone willing to help you.I searched for tutorials but couldn't find one on how to install Derelict on Ubuntu.The documentation link Jordan gave you should suffice. But again, I strongly recommend you use DUB to build and manage your project. In that case: https://derelictorg.github.io/building/with-dub/To make things even worse, I discovered that one needs not only to install Derelict but after that needs to install other libraries too that do not come with Derelict.All the Derelict packages com with everything you need to use the Derelict packages. It's up to you to get the C libraries you want. Some come precompiled, some can be installed via your system package manager, some require you to build yourself. You'll need to visit the homepage of the C libraries you want to install use or, alternatively, do a search for how to install them on your system. On Ubuntu, most of what you want is available through apt-get. Just be careful about using the proper version of the Derelict bindings for each library version you use.Please tell me step by step how to make Derelict work with my Code::Blocks. I would like to make it system wide available, so that it is available for any project I make in CB.Asking for a step-by-step tutorial in the forums is a bit much. All of the information you need is already out there. The CB site and documentation will show you how to configure paths in CB. There are numerous tutorials around that explain the concepts of compiling and linking. The Derelict documentation shows you how to compile and use the Derelict packages both with and without DUB. You don't need to "install" the Derelict packages system wide on a single-user system. Keeping them in your home directory is fine. Just tell the compiler how to find them once they're compiled and you're building your project. Let's assume you're using SDL to get your OpenGL window. Then you'll need to follow the instructions at the link Jordan gave you to fetch and build DerelictUtil, DerelictSDL2, and DerelictGL3. Once that's done, for simplicity's sake, create a new directory tree. Let's say something like this in your home directory: - dev -- D --- import --- lib Copy the Derelict source tree from each Derelict package you built (everything under the source directory in each package, including the directories) into the import directory so that you have this tree: - import -- derelict --- gl3 --- sdl2 --- util Copy the libraries you compiled into the lib directory, so that you have this: - lib -- libDerelictGL3.a -- libDerelictSDL2.a -- libDerelictUtil.a Once that's done, configure your CB project so that the DMD import path is ~/dev/D/import and the library import path is ~/dev/D/lib. Then add the three libraries to the link list in your project settings. I haven't looked at CB in years so I have no idea what the specifics are, but all IDEs are similar in this regard. But again, I highly recommend you forget about CB for D development while you're learning and use a text editor + DUB instead. VS Code is great for this because it has a built-in terminal. You can skip most of the above (you'll still need to obtain the C libraries), create a DUB package recipe, start writing your D code, then hit the Ctrl-~ to pull up the terminal in your project directory and type 'dub'. DUB will make sure your D dependencies are downloaded and compiled, then compile and link your executable.
Dec 10 2017
On Monday, 11 December 2017 at 07:34:47 UTC, Mike Parker wrote:On Sunday, 10 December 2017 at 16:50:10 UTC, RegeleIONESCU wrote:Hello every body! I know it is four months old thread. But now I found the solution! :) As Mike Parker suggested, DUB + Sublime is the solution. DUB works so simple, so nice! DUB works like a charm it imports by itself all the needed libraries and does lots of other stuff. The only problem I have with DUB is that all added dependencies are "old". For example added dependency "derelict-sdl2" is version="~>2.1.4" while on DUB site the last version is 3.1.0-alpha.3. I tried the --upgrade plus --prerelease option but the dependencies remain the same. I tried to write myself the version in the dub.sdl but I get errors related to other packages. Is there anyway to make DUB automatically use the latest version of a dependency? Thank you all for your kind support![...]My advice is to ditch Code::Blocks and use something like VS Code or Sublime Text in conjunction with DUB. It's by far the easiest way to get started with D, particularly for someone who as little practical experience with compilers and linkers. Then you don't have to worry about "installing" Derelict. You can get the Ubuntu packages for the C libraries you need via apt-get on Ubuntu, then use DUB to manage and build your project. Piece of cake compared to doing it all by hand. [...]
May 02 2018
On Thursday, 3 May 2018 at 03:18:02 UTC, RegeleIONESCU wrote:The only problem I have with DUB is that all added dependencies are "old". For example added dependency "derelict-sdl2" is version="~>2.1.4" while on DUB site the last version is 3.1.0-alpha.3. I tried the --upgrade plus --prerelease option but the dependencies remain the same. I tried to write myself the version in the dub.sdl but I get errors related to other packages. Is there anyway to make DUB automatically use the latest version of a dependency?You an control that with precision, specifying specific versions if you want. But with Derelict, if you're using mulitple Derelict package you have to make sure that all of them depend on the same major version of DerelictUtil. If you paste your full dependency list here, exactly as it's written in your package configuration, I might be able to help you.
May 02 2018
On Thursday, 3 May 2018 at 06:33:53 UTC, Mike Parker wrote:On Thursday, 3 May 2018 at 03:18:02 UTC, RegeleIONESCU wrote:Hello! I tried to execute the example from Derelict-SDL2 but I get some troubles. Here is the program: import std.stdio; import derelict.sdl2.sdl; import derelict.sdl2.image; import derelict.sdl2.mixer; import derelict.sdl2.ttf; import derelict.sdl2.net; void main() { DerelictSDL2.load(); DerelictSDL2Image.load(); DerelictSDL2Mixer.load(); DerelictSDL2ttf.load(); DerelictSDL2Net.load(); writeln("What is wrong????????????????"); } Here is the dub.sdl file content: name "project_01" description "SDL2_image test app" authors "Christian" copyright "Copyright © 2018, Christian" license "proprietary" dependency "derelict-sdl2" version="~>2.1.4" Here is the dub.selections.json { "fileVersion": 1, "versions": { "derelict-sdl2": "2.1.4", "derelict-util": "2.0.6" } } And here is the error I get when I execute dub run: christian Christians:~/D_Projects$ dub run Performing "debug" build using /usr/bin/dmd for x86_64. derelict-util 2.0.6: target for configuration "library" is up to date. derelict-sdl2 2.1.4: target for configuration "library" is up to date. project_01 ~master: building configuration "application"... Linking... To force a rebuild of up-to-date targets, run again with --force. Running ./project_01 derelict.util.exception.SymbolLoadException ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/u il/exception.d(35): Failed to load symbol SDL_DequeueAudio from shared library libSDL2-2.0.so.0 ---------------- ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/ til/sharedlib.d:177 void* derelict.util.sharedlib.SharedLib.loadSymbol(immutable(char)[], bool) [0x450eef] ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/dereli t/util/loader.d:323 void* derelict.util.loader.SharedLibLoader.loadSymbol(immutable(char)[], bool) [0x44f42a] ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/dereli t/util/loader.d:346 void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool) [0x44f480] ../../.dub/packages/derelict-sdl2-2.1.4/derelict-sdl2/source/der lict/sdl2/sdl.d:111 void derelict.sdl2.sdl.DerelictSDL2Loader.loadSymbols() [0x44ab1f] ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/dereli t/util/loader.d:198 void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0x44f2aa] ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/dereli t/util/loader.d:143 void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0x44f224] ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derel ct/util/loader.d:82 void derelict.util.loader.SharedLibLoader.load() [0x44f107] source/app.d:10 _Dmain [0x44899a] Program exited with code 1 christian Christians:~/D_Projects$ Could you help me, please? Thank you very much for your kind support! p.s. I am using Ubuntu 16.04.The only problem I have with DUB is that all added dependencies are "old". For example added dependency "derelict-sdl2" is version="~>2.1.4" while on DUB site the last version is 3.1.0-alpha.3. I tried the --upgrade plus --prerelease option but the dependencies remain the same. I tried to write myself the version in the dub.sdl but I get errors related to other packages. Is there anyway to make DUB automatically use the latest version of a dependency?You an control that with precision, specifying specific versions if you want. But with Derelict, if you're using mulitple Derelict package you have to make sure that all of them depend on the same major version of DerelictUtil. If you paste your full dependency list here, exactly as it's written in your package configuration, I might be able to help you.
May 03 2018
On Thursday, 3 May 2018 at 18:36:04 UTC, RegeleIONESCU wrote:And here is the error I get when I execute dub run: christian Christians:~/D_Projects$ dub run Performing "debug" build using /usr/bin/dmd for x86_64. derelict-util 2.0.6: target for configuration "library" is up to date. derelict-sdl2 2.1.4: target for configuration "library" is up to date. project_01 ~master: building configuration "application"... Linking... To force a rebuild of up-to-date targets, run again with --force. Running ./project_01 derelict.util.exception.SymbolLoadException ../../.dub/packages/derelict-util-2.0.6/derelict-util/source/derelict/u il/exception.d(35): Failed to load symbol SDL_DequeueAudio from shared library libSDL2-2.0.so.0So your app is compiling and executing. This is a runtime error. The SymbolLoadException means the SDL library was loaded, but a function Derelict expected to find was not there. This usually means that your version of Derelict by default supports a different version of SDL than you have on your system. SDL_DequeueAudio was added to SDL in 2.0.5. The best strategy is just to request the minimum version of SDL that you need via a SharedLibVersion: import derelict.util.loader : SharedLibVersion; DerelictSDL2.load(SharedLibVersion(2, 0, 0)); If you need functions from a later version, use that instead (e.g. 2,0,2). Just make sure you have the version of SDL that you need installed. Also, if you're going to load all of the libraries as in the example, you'll need to make sure they're all installed (SDL_image, SDL_mixer, SDL_net, SDL_ttf). I suggest you delete all except what you actually need. That's not your current problem, but you'll get more exceptions if those libraries aren't installed. If you want to update to derelict-sdl2 3.0.x or 3.1.x, delete your dub.selections.json before running dub after you edit your package configuration.
May 03 2018
On Thursday, 3 May 2018 at 19:30:48 UTC, Mike Parker wrote:On Thursday, 3 May 2018 at 18:36:04 UTC, RegeleIONESCU wrote:It works, even when loading all the libraries. I played with different versions and loaded libraries one by one to see how it works. I even managed to make a window - for me it is a big thing. Thank you, thank you, thank you for your kind and detailed support![...]So your app is compiling and executing. This is a runtime error. The SymbolLoadException means the SDL library was loaded, but a function Derelict expected to find was not there. This usually means that your version of Derelict by default supports a different version of SDL than you have on your system. [...]
May 04 2018