webui-dev / v-webui

Use any web browser as GUI, with V in the backend and modern web technologies in the frontend.
https://webui.me
MIT License
112 stars 11 forks source link

TCC Issue #21

Open AlbertShown opened 1 year ago

AlbertShown commented 1 year ago

I was trying to compile text-editor.v but I got

builder error: 'tlhelp32.h' not found

This is because https://github.com/civetweb/civetweb/issues/1158

malisipi commented 1 year ago

It's needed to be patched from civetweb or webui. I can not do anything for it except creating an issue on webui.

malisipi commented 1 year ago

Also you can still use GCC/Clang for test it until the fix

hassandraga commented 1 year ago

This is not an issue. TCC does not have tlhelp32.h. You should add it manually. Could you copy it from your MinGW installation folder?

AlbertShown commented 1 year ago

@malisipi Perhaps we should add a readme file inside the examples folder to show how to compile and switch to GCCC/Clang backend if needed.

malisipi commented 1 year ago

Is it really needed? V documentation have the informations

[~]$ v help build-c
This command compiles the given target, along with their dependencies, into an executable.

Usage:
  v [build flags] ['run'] <target.v|target_directory> [run options]

This help topic explores the C-backend specific build flags. For more general build help,
see also `v help build`.

# Interfacing the C compiler, passing options to it:
   -cc <compiler>
      Change the C compiler V invokes to the specified compiler.
      The C compiler is required to support C99.
      Officially supported/tested C compilers include:
      `clang`, `gcc`, `tcc`, `mingw-w64` and `msvc`.
AlbertShown commented 1 year ago

For V experts like you and V developers, they don't need it, but beginners in V and also those who try V for the first time need a readme file to make the experience easier and fun 😁

malisipi commented 1 year ago

I added a info to readme faq 896e3a1a2a564a4df8133c7496dc99fd008018ee

malisipi commented 1 year ago

v text-editor.v

tcc: error: undefined symbol 'opendir'
tcc: error: undefined symbol 'closedir'
tcc: error: undefined symbol 'IsWow64Process'
AlbertShown commented 1 year ago

Is there a way to make V-WebUI use the prebuilt WebUI binaries instead of building it from the source? Go-WebUI uses static pre-built binaries. And Python-WebUI and Deno use dynamic pre-built binaries.

AlbertShown commented 1 year ago

TCC support using GCC static pre-built binaries means this issue will be fixed.

malisipi commented 1 year ago

It's actually good idea. I can test to create a object file by GCC and use it with TCC.

ttytm commented 1 year ago

I did some tests, unfortunately without success.

Prior to the tests tlhelp32.h was added manually to TCCs include dir. Without this step it would be possible to compile the WebUI parent library.

C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.1316904748510759959.tmp.c:501: warning: WINVER redefined
In file included from C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.1316904748510759959.tmp.c:762:
In file included from C:/Users/vboxuser/.vmodules/vwebui/webui/webui.h:56:
In file included from c:/users/vboxuser/git/v/thirdparty/tcc/include/tlhelp32.h:19:
c:/users/vboxuser/git/v/thirdparty/tcc/include/winapi/winapifamily.h:21: warning: WINAPI_FAMILY_PARTITION redefined
C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.1316904748510759959.tmp.c:6902: warning: implicit declaration of function 'tcc_backtrace'
tcc: error: undefined symbol 'strtoll'
tcc: error: undefined symbol 'SleepConditionVariableCS'
tcc: error: undefined symbol 'opendir'
tcc: error: undefined symbol 'closedir'
tcc: error: undefined symbol 'RegOpenKeyExW'
tcc: error: undefined symbol 'RegQueryValueExW'
tcc: error: undefined symbol 'RegCloseKey'
tcc: error: undefined symbol 'strtoull'
tcc: error: undefined symbol 'IsWow64Process'
hassandraga commented 1 year ago

Tested compiling with TCC using the GCC build files

I believe TCC is compatible with GNU GCC ABI, normally, TCC can use objects compiled using GCC.

TCC doesn't produce a dynamic lib .dll

I guess someone suggested a while ago to remove dynamic compiling part, because TCC needs tlhelp32.h to do that.

hassandraga commented 1 year ago

I guess as a workaround, we can add tlhelp32.h in the V-WebUI package, then add an include flag to make TCC find the include file... I don't know if that is possible.

ttytm commented 1 year ago

If we get TCC to work, then I think it's worth it to add the tlhelp32.h. Currently, it does not work with V when having it included.

I believe TCC is compatible with GNU GCC ABI, normally, TCC can use objects compiled using GCC.

:+1: TCC compilation works on linux when using the GCC output.

TCC compiling on Windows when using the GCC output results in an invalid object file error:

C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.8069971448029196647.tmp.c:501: warning: WINVER redefined
In file included from C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.8069971448029196647.tmp.c:762:
In file included from C:/Users/vboxuser/.vmodules/vwebui/webui/webui.h:56:
In file included from c:/users/vboxuser/git/v/thirdparty/tcc/include/tlhelp32.h:19:
c:/users/vboxuser/git/v/thirdparty/tcc/include/winapi/winapifamily.h:21: warning: WINAPI_FAMILY_PARTITION redefined
C:/Users/vboxuser/AppData/Local/Temp/v_0/minimal.8069971448029196647.tmp.c:6902: warning: implicit declaration of function 'tcc_backtrace'
tcc: error: invalid object file
tcc: error: library 'webui-2-static-x64' not found

The longer error I posted in the reply above is trying to use the TCC prebuilt.

hassandraga commented 1 year ago

I will look into this