Jump to page: 1 2
Thread overview
Problem getting Cimgui to work
Dec 06, 2017
Thomas
Dec 06, 2017
drug
Dec 06, 2017
drug
Dec 06, 2017
Thomas
Dec 06, 2017
drug
Dec 06, 2017
Thomas
Dec 06, 2017
Thomas
Dec 06, 2017
Thomas
Dec 07, 2017
Mike Parker
Dec 07, 2017
Thomas
Dec 06, 2017
Thomas
December 06, 2017
Hi guys!

I need some help or advice about Cimgui (a C-API for Imgui) because I have no idea how to get it working.

First, I'm new to D (only a few weeks) and still learning. I have a small C++/C# background, but wanted to try something new. So D got into my focus.
I am working on Manjaro Linux btw.

Since 2 weeks I am working on a small project of mine to test the SDL2 functions with derelict. Until now everything worked just fine and I got my first window in SDL.
For this I have installed all SDL library and development files with the package manager of Manjaro Linux. Even GLFW.

To fill the SDL window with some widgets I have decided to try Imgui via Cimgui.
My first approach was to use the derelict-imgui version 0.9.4 over DUB.
import derelict.imgui.imgui; has been accepted yet, but DerelictImgui.load(); not

While compiling I got the following error message:

derelict.util.exception.SharedLibLoadException@../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(158): Failed to load one or more shared libraries:
	cimgui.so - cimgui.so: cannot open shared object file: No such file or directory

so Cimgui was missing..

Ok, so in a second attempt I downloaded Cimgui as a ZIP and also the Imgui files from the homepage into the appropriate directory and unzipped them. First, the compiling via make doesn't wanted to compile:


cimgui.cpp: In Funktion »void ImGuiTextBuffer_append(ImGuiTextBuffer*, const char*, ...)«:
cimgui.cpp:1716:13: Fehler: »struct ImGuiTextBuffer« hat kein Element namens »appendv«; meinten Sie »appendf«?
     buffer->appendv(fmt, args);


Translated from german -> "there is no element appendv in ImGuiTextBuffer"

So I changed the code myself on that position by replacing "appendv" with "appendf"
That worked fine. But next problem was this:


/usr/bin/ld: ../imgui/imgui.o: relocation R_X86_64_PC32 against symbol `_ZN6ImVec2C1Eff' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value


After some research I found out it meant that the imgui files had not been compiled with -fPIC to be used as a shared library. So I deleted all .o files in the imgui directory and recompiled
imgui.cpp
imgui_draw.cpp and
imgui_demo.cpp
each with "g++ -c -fPIC -pie"
So I copied the new compiled .o files to the cimgui project and recompiled it again.
This time it worked without problems :-)

The new shared library file cimgui.so moved to my project directory and exported LD_LIBRARY_PATH so it could be found by the compiler.
This time the compiler cried this error:


derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol igPushIdPtr from shared library cimgui.so
----------------
??:? void* derelict.util.sharedlib.SharedLib.loadSymbol(immutable(char)[], bool) [0xcfec77a6]
??:? void* derelict.util.loader.SharedLibLoader.loadSymbol(immutable(char)[], bool) [0xcfec5cce]
??:? void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool) [0xcfec5978]
??:? void derelict.imgui.imgui.DerelictImguiLoader.loadSymbols() [0xcfebe7a5]
??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0xcfec5b4e]
??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0xcfec5ac8]
??:? void derelict.util.loader.SharedLibLoader.load() [0xcfec59ab]
??:? _Dmain [0xcfeae0af]
Program exited with code 1


After some research again I found a workaround on the Derelict Util homepage:



import derelict.util.exception : ShouldThrow;

ShouldThrow myMissingSymbCB( string symbolName )
{
		if ( symbolName == "igSetNextWindowPosCenter" ||
		     symbolName == "igAlignFirstTextHeightToWidgets" ||
		     symbolName == "igPushIdStr" ||
		     symbolName == "igPushIdStrRange" )
		{
			return ShouldThrow.No;
		}
		else
		{
			return ShouldThrow.Yes;
		}
}

int main()
{
    DerelictImgui.missingSymbolCallback = &myMissingSymbCB;
    DerelictImgui.load();
}


But with each attempt to compile my project with "dub" by adding the next symbol name into the list above a new symbol fails to load. Again and again.

Since 1 week I tried several ways to get the libray to work. Unfortunately without success.

Because I couldn't find any relevant information on the internet about this problem I hope to get a solution here. Maybe someone (an Cimgui expert here?) can give me a step by step instruction how to compile the library properly ?

Thank you!
December 06, 2017
06.12.2017 20:51, Thomas пишет:
> Hi guys!
> 
> I need some help or advice about Cimgui (a C-API for Imgui) because I have no idea how to get it working.
> 
> First, I'm new to D (only a few weeks) and still learning. I have a small C++/C# background, but wanted to try something new. So D got into my focus.
> I am working on Manjaro Linux btw.
> 
> Since 2 weeks I am working on a small project of mine to test the SDL2 functions with derelict. Until now everything worked just fine and I got my first window in SDL.
> For this I have installed all SDL library and development files with the package manager of Manjaro Linux. Even GLFW.
> 
> To fill the SDL window with some widgets I have decided to try Imgui via Cimgui.
> My first approach was to use the derelict-imgui version 0.9.4 over DUB.
> import derelict.imgui.imgui; has been accepted yet, but DerelictImgui.load(); not
> 
> While compiling I got the following error message:
> 
> derelict.util.exception.SharedLibLoadException@../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(158): Failed to load one or more shared libraries:
>      cimgui.so - cimgui.so: cannot open shared object file: No such file or directory
> 
> so Cimgui was missing..
> 
> Ok, so in a second attempt I downloaded Cimgui as a ZIP and also the Imgui files from the homepage into the appropriate directory and unzipped them. First, the compiling via make doesn't wanted to compile:
> 
> 
> cimgui.cpp: In Funktion »void ImGuiTextBuffer_append(ImGuiTextBuffer*, const char*, ...)«:
> cimgui.cpp:1716:13: Fehler: »struct ImGuiTextBuffer« hat kein Element namens »appendv«; meinten Sie »appendf«?
>       buffer->appendv(fmt, args);
> 
> 
> Translated from german -> "there is no element appendv in ImGuiTextBuffer"
> 
> So I changed the code myself on that position by replacing "appendv" with "appendf"
> That worked fine. But next problem was this:
> 
> 
> /usr/bin/ld: ../imgui/imgui.o: relocation R_X86_64_PC32 against symbol `_ZN6ImVec2C1Eff' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> 
> 
> After some research I found out it meant that the imgui files had not been compiled with -fPIC to be used as a shared library. So I deleted all .o files in the imgui directory and recompiled
> imgui.cpp
> imgui_draw.cpp and
> imgui_demo.cpp
> each with "g++ -c -fPIC -pie"
> So I copied the new compiled .o files to the cimgui project and recompiled it again.
> This time it worked without problems :-)
> 
> The new shared library file cimgui.so moved to my project directory and exported LD_LIBRARY_PATH so it could be found by the compiler.
> This time the compiler cried this error:
> 
> 
> derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol igPushIdPtr from shared library cimgui.so
> ----------------
> ??:? void* derelict.util.sharedlib.SharedLib.loadSymbol(immutable(char)[], bool) [0xcfec77a6]
> ??:? void* derelict.util.loader.SharedLibLoader.loadSymbol(immutable(char)[], bool) [0xcfec5cce]
> ??:? void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool) [0xcfec5978]
> ??:? void derelict.imgui.imgui.DerelictImguiLoader.loadSymbols() [0xcfebe7a5]
> ??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0xcfec5b4e]
> ??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0xcfec5ac8]
> ??:? void derelict.util.loader.SharedLibLoader.load() [0xcfec59ab]
> ??:? _Dmain [0xcfeae0af]
> Program exited with code 1
> 
> 
> After some research again I found a workaround on the Derelict Util homepage:
> 
> 
> 
> import derelict.util.exception : ShouldThrow;
> 
> ShouldThrow myMissingSymbCB( string symbolName )
> {
>          if ( symbolName == "igSetNextWindowPosCenter" ||
>               symbolName == "igAlignFirstTextHeightToWidgets" ||
>               symbolName == "igPushIdStr" ||
>               symbolName == "igPushIdStrRange" )
>          {
>              return ShouldThrow.No;
>          }
>          else
>          {
>              return ShouldThrow.Yes;
>          }
> }
> 
> int main()
> {
>      DerelictImgui.missingSymbolCallback = &myMissingSymbCB;
>      DerelictImgui.load();
> }
> 
> 
> But with each attempt to compile my project with "dub" by adding the next symbol name into the list above a new symbol fails to load. Again and again.
> 
> Since 1 week I tried several ways to get the libray to work. Unfortunately without success.
> 
> Because I couldn't find any relevant information on the internet about this problem I hope to get a solution here. Maybe someone (an Cimgui expert here?) can give me a step by step instruction how to compile the library properly ?
> 
> Thank you!
Could you describe what dub package you tried to build first of all? It helps to reproduce your case.
December 06, 2017
probably this can help you
https://github.com/drug007/timespatial
this project uses cimgui by means of derelict-imgui
December 06, 2017
> Could you describe what dub package you tried to build first of all? It helps to reproduce your case.

Hello.

In my personal project folder I only have:
derelict-sdl2   version="~>3.1.0-alpha.2"
derelict-imgui  version="~>0.9.4"

Then I realized that I needed the shared library file cimgui.so

Unfortunately there is no DUB for Cimgui itself, so I downloaded it via ZIP + the Imgui ZIP from the homepage
https://github.com/Extrawurst/cimgui/archive/master.zip  and
https://github.com/ocornut/imgui/archive/master.zip

Extracted and copied the imgui files into the cimgui/imgui directory, because the make file of cimgui needet it. The first compiled cimgui.so file didn't work because the same problem with the symbol names at the end of my last post.

So I deleted the Cimgui + Imgui directory again and cloned it by GIT this time.
Compilation didn't work because of the -fPIC problem. So I compiled the imgui .cpp files by hand with "g++ -c -fPIC -pie" to be able to compile cimgui.

Thats all.

Thank you for your time!

December 06, 2017
On Wednesday, 6 December 2017 at 18:27:20 UTC, drug wrote:
> probably this can help you
> https://github.com/drug007/timespatial
> this project uses cimgui by means of derelict-imgui

Hi, thank you. I tried it and first it seemed to work, but after I entered "dub build config=demo" following error messages occured:

Fetching taggedalgebraic 0.10.7 (getting selected version)...
Fetching msgpack-d 1.0.0-beta.6 (getting selected version)...
Fetching d2sqlite3 0.9.8 (getting selected version)...
Fetching gfm 6.1.4 (getting selected version)...
Fetching dstats 1.0.3 (getting selected version)...
Fetching emsi_containers 0.5.3 (getting selected version)...
Fetching color 0.0.5 (getting selected version)...
Performing "debug" build using dmd for x86_64.
d2sqlite3 0.9.8: building configuration "with-lib"...
derelict-util 2.0.6: target for configuration "library" is up to date.
derelict-imgui ~master: building configuration "library"...
DerelictImgui/source/derelict/imgui/funcs.d(38,12): Deprecation: module std.c.stdarg is deprecated - Import core.stdc.stdarg instead
dstats 1.0.3: building configuration "library"...
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(1056,8): Deprecation: dstats.summary.reduce is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(1056,8): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(1106,38): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(1109,31): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(2119,20): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(2226,15): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/regress.d(2233,12): Deprecation: dstats.alloc.max is not visible from module regress
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1458,24): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1461,24): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1501,9): Deprecation: dstats.summary.swap is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1502,23): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1799,24): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1802,24): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(1821,9): Deprecation: dstats.summary.swap is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(3594,20): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(3596,20): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(3637,31): Deprecation: dstats.summary.min is not visible from module tests
../../.dub/packages/dstats-1.0.3/dstats/source/dstats/tests.d(3646,9): Deprecation: dstats.summary.swap is not visible from module tests
emsi_containers 0.5.3: building configuration "library"...
gfm:math 6.1.4: building configuration "library"...
derelict-gl3 1.0.23: target for configuration "library" is up to date.
gfm:opengl 6.1.4: building configuration "library"...
derelict-sdl2 1.9.7: building configuration "library"...
gfm:sdl2 6.1.4: building configuration "library"...
msgpack-d 1.0.0-beta.6: building configuration "library"...
taggedalgebraic 0.10.7: building configuration "library"...
timespatial 0.0.3+commit.167.gd82e6dd: building configuration "demo"...
DerelictImgui/source/derelict/imgui/funcs.d(38,12): Deprecation: module std.c.stdarg is deprecated - Import core.stdc.stdarg instead
/usr/include/dlang/dmd/std/conv.d(4502,34): Error: cannot cast expression chunk.idx.idx of type TreeMap!(uint, DataSet, Mallocator, "a<b", false, 64LU) to void*
/usr/include/dlang/dmd/std/conv.d(4604,21): Error: template instance std.conv.emplace!(DataSource, DataSourceHeader) error instantiating
/usr/include/dlang/dmd/std/experimental/allocator/package.d(672,52):        instantiated from here: emplace!(DataSource, DataSourceHeader)
demo/app.d(208,55):        instantiated from here: make!(DataSource, StatsCollector!(Region!(Mallocator, 16u, cast(Flag)false), 262143LU, 262143LU)*, DataSourceHeader)
source/data_index.d(143,27):        instantiated from here: processElement!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value"))
source/data_index.d(136,14):        ... (1 instantiations, -v to show) ...
source/data_index.d(391,25):        instantiated from here: __ctor!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value")[])
demo/app.d(91,20):        instantiated from here: DataIndex!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value")[], DataSourceHeader, DataSetHeader, DataElement, ProcessElement)
/usr/include/dlang/dmd/std/experimental/allocator/package.d(689,49): Error: forward reference to inferred return type of function call 'function ()
{
alloc.deallocate(m);
}
()'
/usr/include/dlang/dmd/std/conv.d(4502,34): Error: cannot cast expression chunk.idx of type DynamicArray!(DataElement, Mallocator, false) to void*
/usr/include/dlang/dmd/std/conv.d(4604,21): Error: template instance std.conv.emplace!(DataSet, DataSetHeader) error instantiating
/usr/include/dlang/dmd/std/experimental/allocator/package.d(672,52):        instantiated from here: emplace!(DataSet, DataSetHeader)
demo/app.d(219,49):        instantiated from here: make!(DataSet, StatsCollector!(Region!(Mallocator, 16u, cast(Flag)false), 262143LU, 262143LU)*, DataSetHeader)
source/data_index.d(143,27):        instantiated from here: processElement!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value"))
source/data_index.d(136,14):        ... (1 instantiations, -v to show) ...
source/data_index.d(391,25):        instantiated from here: __ctor!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value")[])
demo/app.d(91,20):        instantiated from here: DataIndex!(Tuple!(int, "index", TaggedAlgebraic!(Base), "value")[], DataSourceHeader, DataSetHeader, DataElement, ProcessElement)
/usr/include/dlang/dmd/std/experimental/allocator/package.d(689,49): Error: forward reference to inferred return type of function call 'function ()
{
alloc.deallocate(m);
}
()'
source/default_viewer.d(83,20): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(83,20): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(84,23): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(96,20): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(96,20): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(97,23): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(814,27): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
source/default_viewer.d(814,27): Deprecation: struct std.datetime.StopWatch is deprecated - Use std.datetime.stopwatch.StopWatch.
dmd failed with exit code 1.
December 06, 2017
I've check it before posting using old version dmd 2.073 and it works.
What dmd version you compile with?
December 06, 2017
On Wednesday, 6 December 2017 at 19:12:43 UTC, drug wrote:
> I've check it before posting using old version dmd 2.073 and it works.
> What dmd version you compile with?

Hi. The newest as I know. Version 2.077.0   (64bit Version)

But the error messages in my last post don't seem to relate to my problem, but of some depricated stuff of dmd module "conv".

I am now analysing your way to implement Cimgui into your project. As far as I could find out till now youre using a script to clone the whole cimgui stuff into your project directory. I didn't know that this is possible :-)
The next difference I found is the -shared flag on compilation of the cimgui files. Maybe that is the big deal.
And at last point loading the shared lib is totaly different.

I will try it the same way. If it loads the shared library correct thats more than I could hope :-)

Thank you.
December 06, 2017
On Wednesday, 6 December 2017 at 19:37:54 UTC, Thomas wrote:
> On Wednesday, 6 December 2017 at 19:12:43 UTC, drug wrote:
>> I've check it before posting using old version dmd 2.073 and it works.
>> What dmd version you compile with?
>
> Hi. The newest as I know. Version 2.077.0   (64bit Version)
>
> But the error messages in my last post don't seem to relate to my problem, but of some depricated stuff of dmd module "conv".
>
> I am now analysing your way to implement Cimgui into your project. As far as I could find out till now youre using a script to clone the whole cimgui stuff into your project directory. I didn't know that this is possible :-)
> The next difference I found is the -shared flag on compilation of the cimgui files. Maybe that is the big deal.
> And at last point loading the shared lib is totaly different.
>
> I will try it the same way. If it loads the shared library correct thats more than I could hope :-)
>
> Thank you.


I tried it now your way. First I cloned cimgui + imgui inside my project the same way with the build.sh script. That worked out of the box.
Next I wrote a new app.d file only using the necessary code for testing:


import std.stdio;
import derelict.imgui.imgui: DerelictImgui;

int main()
{
   DerelictImgui.load("DerelictImgui/cimgui/cimgui/cimgui.so");
   return 0;
}


After compiling with dub again the same problem with symbol names ->

"Failed to load symbol igSetNextWindowSizeConstraints from shared library DerelictImgui/cimgui/cimgui/cimgui.so"

strange..
December 06, 2017
Hi folks!

I got it to work, but honestly I don't know why.. :-)

1. clone project imgui_d_test with git
2. subloading the base cimgui stuff by command: git submodule update --init --recursive
3. enter cimgui directory and enter make
4. after that dub doesn't work properly, you have to edit app.d
replace DerelictImgui.load(); with DerelictImgui.load("/..pathToFile../cimgui.so");

Now it works for me! :-)

testet on dmd 2.077.0

@drug007: I have testet the new generated cimgui.so file from imgui_d_test project on your and mine project and it worked. Replacing the file with the shared library generated inside my or your project, the build will not run -> same problem with loading the symbol names.
Hmm.. maybe they did some corrections in project imgui in the last couple of hours ?
Whatever.. i will take the new cimgui.so file and use it.

Thank you for your time!
December 07, 2017
On Wednesday, 6 December 2017 at 21:21:11 UTC, Thomas wrote:
> Hi folks!
>
> I got it to work, but honestly I don't know why.. :-)

Glad you got it working. I wanted to reply earlier but I was on my phone when I first saw this thread. So now instead of helping you solve the problem, I'll throw in a few words to hopefully shed some light on why it worked and help you more easily solve similar issues if they arise in the future.

>
> 1. clone project imgui_d_test with git
> 2. subloading the base cimgui stuff by command: git submodule update --init --recursive

The short answer is that this step is why it worked. I'll elaborate below.

> 3. enter cimgui directory and enter make
> 4. after that dub doesn't work properly, you have to edit app.d
> replace DerelictImgui.load(); with DerelictImgui.load("/..pathToFile../cimgui.so");

You shouldn't ever have to do this if things are properly configured.


> Hmm.. maybe they did some corrections in project imgui in the last couple of hours ?

Not quite :-) But the root of the problem does, indeed, come down to changes in imgui. I'll quote from your previous posts to show how to solve the sort of problem you encountered.

> Ok, so in a second attempt I downloaded Cimgui as a ZIP and also the Imgui files from the homepage into the appropriate directory and unzipped them.

This was the root mistake. Whenever you are using a D binding to a C library, no matter if it's an official Derelict package, an "unofficial" package (i.e., not one maintained as part of the DerelictOrg group, such as derelict-imgui), a Deimos package, or something else, always, always, always make sure the version of the C library you are using matches the version the binding supports. Some Derelict packages, like DerelictSDL2, support multiple versions of their C library via DerelictUtil's SharedLibVersion feature. Most do not.

So the thing to do is to look at the project's code.dlang.org page and see if the info you need is there. If not, follow the link to the source repository on that page and look for any and all documentation you can find to see which version of the binding requires which version of the C library. What happens if there's a version mismatch? This:

> This time the compiler cried this error:

> derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol igPushIdPtr from shared library cimgui.so

A SymbolLoadException almost always indicates that your version of the C library is different (usually older) from the one the Derelict binding expects (in rare cases it can be a corrupt library). The solution is to double check that your versions match. It usually helps to dig into the change logs/release notes of the C library to see if/when any functions were added or removed. That way you can figure out if the binding is outdated, or if you need an older/newer version of the C library.

> After some research again I found a workaround on the Derelict Util homepage:

No, you did not find a workaround :-) The selective loading mechanism is not intended as a workaround for missing symbols. It's intended to be used when you want to support multiple versions of a C library (the SharedLibVersion feature uses it internally), or when the C library on the user's system might be compiled with and without certain features you don't care about. If you don't know the details of the C library or the potential consequences of ignoring any given set of functions, you shouldn't be using this feature. I need to make that clear in the documentation.

> Unfortunately there is no DUB for Cimgui itself

Cimgui is a C library and DUB does not support building C libraries.

===================

So, why did it work for you? From what I can gather, looking at the DerelictIMGUI repo, we see it's implemented against CImgui 1.5.0. Looking at CImgui shows it has been updated to 1.52, which is implemented against imgui 1.52. Looking at the release notes for imgui 1.51 and 1.52, we can find several breaking changes since 1.50. The reason you finally got it to worked is because the submodule tree from DerelictIMGUI gave you version 1.50 of CImgui and Imgui.

So the steps should be:

checkout imgui 1.50
checkout cimgui 1.50
Build both
Put them on your system library path

Then you should be set to use DerelictIMGUI without the need to modify its package recipe.





« First   ‹ Prev
1 2