Thread overview
Derelict on Ubuntu with CODE::BLOCKS
December 10
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!
December 10
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


December 11
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.