Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCC Issue #21

Open
AlbertShown opened this issue May 9, 2023 · 16 comments
Open

TCC Issue #21

AlbertShown opened this issue May 9, 2023 · 16 comments

Comments

@AlbertShown
Copy link
Contributor

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

builder error: 'tlhelp32.h' not found

This is because civetweb/civetweb#1158

@malisipi
Copy link
Collaborator

malisipi commented May 9, 2023

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

@malisipi
Copy link
Collaborator

malisipi commented May 9, 2023

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

@malisipi malisipi pinned this issue May 9, 2023
@hassandraga
Copy link
Member

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
Copy link
Contributor Author

@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
Copy link
Collaborator

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
Copy link
Contributor Author

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
Copy link
Collaborator

I added a info to readme faq 896e3a1

@malisipi
Copy link
Collaborator

v text-editor.v

tcc: error: undefined symbol 'opendir'
tcc: error: undefined symbol 'closedir'
tcc: error: undefined symbol 'IsWow64Process'

@AlbertShown
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@malisipi
Copy link
Collaborator

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

@ttytm
Copy link
Member

ttytm commented Aug 25, 2023

I did some tests, unfortunately without success.

  • Tested compiling with TCC using the GCC build files
  • Tested compiling with TCC using the TCC build files (TCC doesn't produce a dynamic lib .dll)
  • Tested compiling with TCC using the TCC static and GCC dynamic output.

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

ttytm commented Aug 25, 2023

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.

👍 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
Copy link
Member

I will look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants