nsauzede / vig

⚡ V ImGui module -- dear imgui / cimgui wrapper
MIT License
52 stars 3 forks source link

builder error: 'cimgui.h' not found #2

Open ccpplinux opened 2 years ago

ccpplinux commented 2 years ago

When I am trying to run the program vig/examples/mainig/mainig.v then I am getting the error message "builder error: 'cimgui.h' not found" although I have installed imgui as well as cimgui. The file cimgui.h is in the same folder in which mainig.v is saved. So what could be error? How to specify the path of the header file cimgui.h while running program of https://github.com/nsauzede/vig? Please help me so that I can start using this package.

nsauzede commented 2 years ago

Hi; are you using Linux ? Windows ?

ccpplinux commented 2 years ago

I am using Manjaro Linux.

nsauzede commented 2 years ago

First of all, sorry for the delay. Then I can confirm the error. This is a new message, maybe related to a recent change in V "builder" part ? Thanks for your report, more investigation is needed..

nsauzede commented 2 years ago

In the meantime I figured out that the same mainig example seems to build and run fine, when used within my other sdl test repo (vig is a submodule there)

Could you please try the following ? Just clone sdl2test: git clone https://github.com/nsauzede/sdl2test.git And try it : cd sdl2test ; make mrproper all ; ./mainig_v.exe

If that works for you too, then that may indicate that the local build failure within vig has been overlooked because I mostly developed vig as a submodule

ccpplinux commented 2 years ago

Thanks for reply. When I am running the command make mrproper all then I am getting following error:

cc -std=gnu99 -w -I ./thirdparty/stdatomic/nix -o v1.exe ./vc/v.c -lm -lpthread ./v1.exe -no-parallel -o v2.exe cmd/v cmd/v/v.v:6:1: builder error: bad module definition: cmd/v/v.v imports module "help" but /home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test/v/cmd/v/help/help.v is defined as module examples.mainig.sdl2test.v.cmd.v.help 4 | module main 5 | 6 | import help | ~~~ 7 | import os 8 | import term make[1]: [GNUmakefile:94: all] Error 1 make[1]: Leaving directory '/home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test/v' /home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test touch nsauzede/vsdl2/v.mod ./v/v install nsauzede.vsdl2 make: ./v/v: No such file or directory make: [Makefile:150: /home/ccpplinux/.vmodules/nsauzede/vsdl2/v.mod] Error 127

nsauzede commented 2 years ago

Now that is strange. It means that you don't manage to build the same (recent'ish) V version as me.. 🤔 Are you able to clone https://github.com/vlang/v.git and build it manually ? (ie: cd v ; make)

ccpplinux commented 2 years ago

Yes I am able to install v properly. Even when I am running command v install nsauzede.vsdl2 as per instruction given on the page then it is also installing properly and I am able to run the example with command v run ~/.vmodules/nsauzede/vsdl2/examples/tvintris/tvintris.v. Similarly when I executed the command v install nsauzede.vig then it also worked. However when I am trying to run the command v run ~/.vmodules/nsauzede/vig/examples/mainig/mainig.v then I am getting following error message:

builder error: 'cimgui.h' not found

I think something is wrong with cimgui installation. Can you please give me a hint?

nsauzede commented 2 years ago

Thanks for reply. When I am running the command make mrproper all then I am getting following error:

cc -std=gnu99 -w -I ./thirdparty/stdatomic/nix -o v1.exe ./vc/v.c -lm -lpthread ./v1.exe -no-parallel -o v2.exe cmd/v cmd/v/v.v:6:1: builder error: bad module definition: cmd/v/v.v imports module "help" but /home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test/v/cmd/v/help/help.v is defined as module examples.mainig.sdl2test.v.cmd.v.help 4 | module main 5 | 6 | import help | ~~~ 7 | import os 8 | import term make[1]: [GNUmakefile:94: all] Error 1 make[1]: Leaving directory '/home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test/v' /home/ccpplinux/Nextcloud/VLang/vig/examples/mainig/sdl2test touch nsauzede/vsdl2/v.mod ./v/v install nsauzede.vsdl2 make: ./v/v: No such file or directory make: [Makefile:150: /home/ccpplinux/.vmodules/nsauzede/vsdl2/v.mod] Error 127

I think I now understand what happens : you seem to have cloned sdl2test within vig, which is itself a V module. Don't do that. Because that seems to interfere with V compiler modules handling (unrelated to my actual vig project) Please rather do this:

$ cd /home/ccpplinux/Nextcloud/VLang
$ git clone https://github.com/nsauzede/sdl2test.git
$ cd sdl2test ; make mrproper all ; ./mainig_v.exe

=> This is to ensure that my current vig project is working within sdl2test (which is the primarily dev setup), somewhere else than in my environment.

Then, I could try and figure out what's wrong with other use cases of vig.

Thanks.

ccpplinux commented 2 years ago

Thanks. Now it is working. I am able to run and view the output of the program mainig_v.exe. Thanks a lot.

nsauzede commented 2 years ago

Great. Next, I have to investigate more why vig doesn't work when used standalone..

Jah-On commented 2 years ago

I have been able to get closer, but it appears that the V compiler has indeed changed and will not compile vig.v. See my issue on V's GitHub. I changed the header paths to the full path. I also switched #include <SDL.h> to `

include <SDL/SDL.h>` which fixed the import issues.

Jah-On commented 2 years ago

I should note that I am also on Manjaro Linux too because it's the best ; ).

nsauzede commented 2 years ago

Hello all.

I pushed some commit to try and fix the issue

Please test & report

nsauzede commented 2 years ago

Forgot to mention that you should git clone vig and try as below:

$ mkdir -p ~/.vmodules/nsauzede
$ cd ~/.vmodules/nsauzede
$ git clone https://github.com/nsauzede/vig
$ cd vig
$ make
$ v run examples/mainig/mainig.v

Note that separate nsauzede/vsdl2 should first be installed in .vmodules, too..

Jah-On commented 2 years ago

Sorry to burst your bubble, but I am still having issues. When running the last command you gave, I get the following: INFO: compile withv -live examples/mainig/mainig.v `, if you want to use the [live] function imgui_frame .

/tmp/v_1000/mainig.8113548928954748782.tmp.c:11124: warning: assignment from incompatible pointer type tcc: error: undefined symbol '_ZN5ImGui17GetCurrentContextEv' tcc: error: undefined symbol '_ZN5ImGui5GetIOEv' tcc: error: undefined symbol '_ZN7ImGuiIO22AddInputCharactersUTF8EPKc' tcc: error: undefined symbol '_ZN7ImGuiIO13AddFocusEventEb' tcc: error: undefined symbol '_ZN5ImGui8MemAllocEm' tcc: error: undefined symbol '_ZN5ImGui14IsAnyMouseDownEv' tcc: error: undefined symbol '_ZN5ImGui14GetMouseCursorEv' tcc: error: undefined symbol '_ZN5ImGui7MemFreeEPv' tcc: error: undefined symbol '_ZN11ImFontAtlas18GetTexDataAsRGBA32EPPhPiS2S2' tcc: error: undefined symbol '_Unwind_Resume' tcc: error: undefined symbol '__gxx_personality_v0' ...

(Use v -cg to print the entire error message)

builder error:

C error. This should never happen.

This is a compiler bug, please report it using v bug file.v.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang `

Thanks!

(sdl2 is installed)

Jah-On commented 2 years ago

Wow, that did not format correctly 😂, sorry!

nsauzede commented 2 years ago

@Jah-On can you please perform the following and put back the result ?

$ pwd
$ ls -l

Just to see where you run your command from and whether you have obtained the proper files..

Jah-On commented 2 years ago

@nsauzede pwd: /home/jah-on/.vmodules/nsauzede/vig

ls -l: `total 2424 -rw-r--r-- 1 jah-on jah-on 1072 Nov 13 23:59 LICENSE

-rw-r--r-- 1 jah-on jah-on 1691 Nov 13 23:59 Makefile

-rw-r--r-- 1 jah-on jah-on 820 Nov 13 23:59 README.md

drwxr-xr-x 1 jah-on jah-on 280 Nov 13 23:59 cimgui

-rw-r--r-- 1 jah-on jah-on 169990 Nov 13 23:59 cimgui.h

-rwxr-xr-x 1 jah-on jah-on 1660576 Nov 13 23:59 cimgui.so

drwxr-xr-x 1 jah-on jah-on 12 Nov 13 23:59 examples

-rw-r--r-- 1 jah-on jah-on 3443 Nov 13 23:59 imgui_impl_opengl3.h

-rw-r--r-- 1 jah-on jah-on 30736 Nov 13 23:59 imgui_impl_opengl3.o

-rw-r--r-- 1 jah-on jah-on 1677 Nov 13 23:59 imgui_impl_sdl.h

-rw-r--r-- 1 jah-on jah-on 15456 Nov 13 23:59 imgui_impl_sdl.o

-rw-r--r-- 1 jah-on jah-on 563286 Nov 13 23:59 libcimgui.a

-rw-r--r-- 1 jah-on jah-on 58 Nov 13 23:59 v.mod

-rw-r--r-- 1 jah-on jah-on 4909 Nov 13 23:59 vig.v`

nsauzede commented 2 years ago

hmm now this is strange; I've got the same kind of results on my Ubuntu 21.10... I'm sorry but I'm afraid I have no clues...

Jah-On commented 2 years ago

hmm now this is strange; I've got the same kind of results on my Ubuntu 21.10... I'm sorry but I'm afraid I have no clues...

I have an issue on the V repository for cimgui. You should post your findings there and maybe they can tweak the compiler.

phcreery commented 1 year ago

I am getting a similar error trying to make on msys2 Windows 10

~/.vmodules/nsauzede/vig
$ make
[ -d cimgui ] || git clone --recursive https://github.com/cimgui/cimgui.git
Cloning into 'cimgui'...
remote: Enumerating objects: 4283, done.
remote: Counting objects: 100% (1014/1014), done.
remote: Compressing objects: 100% (420/420), done.
remote: Total 4283 (delta 742), reused 784 (delta 587), pack-reused 3269
Receiving objects: 100% (4283/4283), 9.57 MiB | 16.99 MiB/s, done.
Resolving deltas: 100% (3117/3117), done.
Submodule 'imgui' (https://github.com/ocornut/imgui.git) registered for path 'imgui'
Cloning into '/c/Users/phcre/.vmodules/nsauzede/vig/cimgui/imgui'...
remote: Enumerating objects: 49563, done.
remote: Counting objects: 100% (10348/10348), done.
remote: Compressing objects: 100% (405/405), done.
remote: Total 49563 (delta 10078), reused 10037 (delta 9943), pack-reused 39215
Receiving objects: 100% (49563/49563), 76.12 MiB | 4.24 MiB/s, done.
Resolving deltas: 100% (38370/38370), done.
Submodule path 'imgui': checked out 'dc3e531ff28450bff73fde0163b1d076b6bb5605'
(export CFLAGS= CXXFLAGS= ; cd cimgui ; mkdir bld ; cd bld ; cmake .. ; make)
-- Building for: Ninja
-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (2.1s)
-- Generating done (0.0s)
-- Build files have been written to: C:/Users/phcre/.vmodules/nsauzede/vig/cimgui/bld
make[1]: Entering directory '/c/Users/phcre/.vmodules/nsauzede/vig/cimgui/bld'
make[1]: *** No targets specified and no makefile found.  Stop.
make[1]: Leaving directory '/c/Users/phcre/.vmodules/nsauzede/vig/cimgui/bld'
make: *** [Makefile:42: cimgui/bld/cimgui.so] Error 2
\vig\examples\mainig> v run mainig.v
builder error: 'cimgui.h' not found
phcreery commented 1 year ago

Solved my issue I had to change cmake .. && make to cmake .. && cmake --build . --target all