vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.54k stars 2.14k forks source link

Coroutines fail to build #20857

Open Varpie opened 4 months ago

Varpie commented 4 months ago

Describe the bug

On a fresh installation of V, I am not able to run the simple_coroutines.v example. The error shown is as follows (more detailed errors in the following sections):

$ v -use-coroutines examples/coroutines/simple_coroutines.v
==================
~/[...]/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'photon_recv'
tcc: error: undefined symbol 'photon_send'
tcc: error: undefined symbol 'photon_accept'
tcc: error: undefined symbol 'photon_socket'
tcc: error: undefined symbol 'photon_connect'
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

Reproduction Steps

Expected Behavior

The coroutines .so should be downloaded, then the file should compile successfully.

Current Behavior

$ v -cg -use-coroutines examples/coroutines/simple_coroutines.v
coroutines .so not found, downloading...
done!
In file included from /tmp/v_1000/simple_coroutines.01HPVCRA5NNHHV8AH5DMYWP3VF.tmp.c:1806:
~/[...]/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'photon_recv'
tcc: error: undefined symbol 'photon_send'
tcc: error: undefined symbol 'photon_accept'
tcc: error: undefined symbol 'photon_socket'
tcc: error: undefined symbol 'photon_connect'
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
builder error: 
==================
C error. This should never happen.

Possible Solution

No response

Additional Information/Context

V is up to date, the photonwrapper.so has been successfully downloaded (the same issue happens if I manually download it to be sure that it is the correct file).

I tried to come up with a more minimal example to reproduce the issue, in order to get to the root cause.

Adding the -use-coroutines flag fails with a simple hello world:

$ v -cg -use-coroutines examples/hello_world.v 
/tmp/v_1000/hello_world.01HPVCX18XHQ35GSKWN6AXQ4FQ.tmp.c:12969: warning: implicit declaration of function 'delete_photon_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
builder error: 
==================
C error. This should never happen.

This is unexpected, as it should see that no go instruction is used and compile the hello world like if the -use-coroutines flag wasn't used.

I tried to create a minimal example with go, inspired by the doc's concurrency section:

fn plus(a int, b int) {
    c := a + b
    println(c)
}

fn main() {
    go plus(3, 4)
}

It runs correctly without -use-coroutines, using native threads as described in the documentation. When I try with -use-coroutines, I get the same error as above, but this time with an extra failing function (which corresponds to the added go):

$ v -cg -use-coroutines plus.v
/tmp/v_1000/plus.01HPVE35KBMTSKDRD2AFVKK8W3.tmp.c:12965: warning: implicit declaration of function 'photon_thread_create_and_migrate_to_work_pool'
/tmp/v_1000/plus.01HPVE35KBMTSKDRD2AFVKK8W3.tmp.c:12996: warning: implicit declaration of function 'delete_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
builder error: 
==================
C error. This should never happen.

I got from #20834 that it may be because it is lacking import coroutines (even if it isn't used in the code), so I tried to add it. As there is a folder examples/coroutines that would be used by the import coroutines, I also had to move the file in a different folder.

It gives a different error:

$ v -cg -use-coroutines plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
In file included from /tmp/v_1000/plus.01HPVE7D6YECWZYKVBQ437WB3V.tmp.c:1132:
~/[...]/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
builder error: 
==================
C error. This should never happen.

And with the added import coroutines, the compilation also fails without using the coroutine flag:

$ v -cg plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
In file included from /tmp/v_1000/plus.01HPVE9AC7CHXGKNFC2VW0D9SB.tmp.c:1131:
~/[...]/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
builder error: 
==================
C error. This should never happen.

The same error happens when using clang (version 16.0.6, thread model posix):

$ v -cc clang -cg plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
In file included from /tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:1131:
~/[...]/v/vlib/coroutines/sp_corrector.c:24:5: error: call to undeclared function 'pthread_getattr_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    pthread_getattr_np((pthread_t)tid, &gattr);
    ^
~/[...]/v/vlib/coroutines/sp_corrector.c:24:5: note: did you mean 'pthread_attr_init'?
/usr/include/pthread.h:285:12: note: 'pthread_attr_init' declared here
extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
           ^
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:16003:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t3.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:22501:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t1.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:23964:4: warning: expression result unused [-Wunused-value]
  (*(os__SignalHandler*)_t3.data);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:28197:4: warning: expression result unused [-Wunused-value]
  (*(os__Result*)_t46.data);
   ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:29842:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t2.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:30179:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t5.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/plus.01HPVECDK5M6VZNHCBV2768TQR.tmp.c:30287:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t1.data);
   ^~~~~~~~~~~~~~~~~~
7 warnings and 1 error generated.
builder error: 
==================
C error. This should never happen.

and gcc (version 13.2.1 20230801):

$ v -cc gcc -cg plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
In file included from /tmp/v_1000/plus.01HPVEESG0FKGQATJ1NZMFBEB1.tmp.c:1131:
~/[...]/v/vlib/coroutines/sp_corrector.c: In function ‘sp_corrector’:
~/[...]/v/vlib/coroutines/sp_corrector.c:24:5: warning: implicit declaration of function ‘pthread_getattr_np’; did you mean ‘pthread_attr_init’? [-Wimplicit-function-declaration]
   24 |     pthread_getattr_np((pthread_t)tid, &gattr);
      |     ^~~~~~~~~~~~~~~~~~
      |     pthread_attr_init
/usr/bin/ld: /tmp/cclxeGZO.o: in function `coroutines__sleep':
/tmp/v_1000/plus.01HPVEESG0FKGQATJ1NZMFBEB1.tmp.c:30300:(.text+0x9b87f): undefined reference to `photon_sleep_ms'
/usr/bin/ld: /tmp/cclxeGZO.o: in function `coroutines__init':
/tmp/v_1000/plus.01HPVEESG0FKGQATJ1NZMFBEB1.tmp.c:30340:(.text+0x9ba56): undefined reference to `set_photon_thread_stack_allocator'
/usr/bin/ld: /tmp/v_1000/plus.01HPVEESG0FKGQATJ1NZMFBEB1.tmp.c:30341:(.text+0x9ba60): undefined reference to `photon_init_default'
/usr/bin/ld: /tmp/v_1000/plus.01HPVEESG0FKGQATJ1NZMFBEB1.tmp.c:30343:(.text+0x9ba80): undefined reference to `init_photon_work_pool'
collect2: error: ld returned 1 exit status
builder error: 
==================
C error. This should never happen.

V version

0.4.4 298a2a2

Environment details (OS name and version, etc.)

V full version: V 0.4.4 298a2a2 OS: linux, "Arch Linux" Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz

getwd: ~/[...]/v vexe: ~/[...]/v/v vexe mtime: 2024-02-17 10:15:13

vroot: OK, value: ~/[...]/v VMODULES: OK, value: ~/.vmodules VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.1 Git vroot status: 8ae05510 .git/config present: true

CC version: cc (GCC) 13.2.1 20230801 thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

spytheman commented 4 months ago

I just want to thank you for the detailed investigation 🙇🏻‍♂️ .

joe-conigliaro commented 4 months ago

Oh so the weird thing is with clang there is only one error regarding 'pthread_getattr_np' which is interesting. all the other symbols are found, I have seen that error before also on my vm.

It must just be how I built it, I will get it rebuilt asap, need to setup another VM.

joe-conigliaro commented 4 months ago

Hi @Varpie I have updated photonwrapper_linux_amd64.so. Could you please delete thirdparty/photon/photonwrapper.so and try again?

v -cg -use-coroutines examples/coroutines/simple_coroutines.v

if it compiles you will need to run it like this for now (so it knows where to find photonwrapper.so):

LD_LIBRARY_PATH=./thirdparty/photon ./examples/coroutines/simple_coroutines

btw I also get this error with clang: error: call to undeclared function 'pthread_getattr_np' I need to fix that. But it's working for me with gcc & tcc.

Varpie commented 4 months ago

I've tried to run v up (to version 0.4.4 efa98d9), delete thirdparty/photon/photonwrapper.so and build the simple_coroutines.v again, but I got the same errors on tcc, gcc and clang. For all of them, pthread_getattr_np isn't found.

I don't have tcc installed on my system, so it uses the tcc shipped with V, which is the most surprising to me. At this point, I expect the other ones to fail because of a missing static library (maybe my Linux isn't configured with GNU's pthread, so it is lacking the pthread_getattr_np which is GNU specific?)

JalonSolov commented 4 months ago

tcc ships with V because tcc in most systems out there is more than 2 years out of date, and won't work properly for V.

JalonSolov commented 4 months ago

FYI... I just tried the compile line, and got this (with latest V):

[jalon@7950x v]$ v -cg -use-coroutines examples/coroutines/simple_coroutines.v
In file included from /tmp/v_1000/simple_coroutines.01HQ1P4AFJK066WW7WCDNXEP2D.tmp.c:1806:
/home/jalon/git/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'photon_recv'
tcc: error: undefined symbol 'photon_send'
tcc: error: undefined symbol 'photon_accept'
tcc: error: undefined symbol 'photon_socket'
tcc: error: undefined symbol 'photon_connect'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
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

[jalon@7950x v]$
JalonSolov commented 4 months ago

Then I tried deleting the photonwrapper.so file I had, and got this:

[jalon@7950x v]$ v -cg -use-coroutines examples/coroutines/simple_coroutines.v
In file included from /tmp/v_1000/simple_coroutines.01HQ1P85BPAD97DE64TRS6EYVM.tmp.c:1806:
/home/jalon/git/v/vlib/coroutines/sp_corrector.c:24: warning: implicit declaration of function 'pthread_getattr_np'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
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

[jalon@7950x v]$ 
Varpie commented 4 months ago

It's odd that V didn't try to download photonwrapper.so again after you deleted it, since you use -use-coroutines...

JalonSolov commented 4 months ago

Oh, it did, but in an intermediate run... that part worked.

Varpie commented 4 months ago

Alright, I got past the missing pthread_getattr_np by adding -cflags -D_GNU_SOURCE to the compile command. The rest of the tcc errors remain however.

And I have the same errors for tcc, gcc and clang: undefined references to the following:

tcc: error: undefined symbol 'photon_recv'
tcc: error: undefined symbol 'photon_send'
tcc: error: undefined symbol 'photon_accept'
tcc: error: undefined symbol 'photon_socket'
tcc: error: undefined symbol 'photon_connect'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
Varpie commented 4 months ago

A few interesting things to note:

If I remove -use-coroutines, I have the following errors:

$ v -cflags -D_GNU_SOURCE -cg examples/coroutines/simple_coroutines.v
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
builder error: 
==================
C error. This should never happen.

Those are presumably only from the use of import coroutines. This is confirmed by the minimal plus.v example described at the start:

$ v -cflags -D_GNU_SOURCE -cg -use-coroutines plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
tcc: error: undefined symbol 'photon_thread_create_and_migrate_to_work_pool'
tcc: error: undefined symbol 'delete_photon_work_pool'
builder error: 
==================
C error. This should never happen.

$ v -cflags -D_GNU_SOURCE -cg plus.v
plus.v:1:8: warning: module 'coroutines' is imported but never used
    1 | import coroutines
      |        ~~~~~~~~~~
    2 | 
    3 | fn plus(a int, b int) {
tcc: error: undefined symbol 'photon_sleep_ms'
tcc: error: undefined symbol 'GC_set_sp_corrector'
tcc: error: undefined symbol 'GC_get_sp_corrector'
tcc: error: undefined symbol 'set_photon_thread_stack_allocator'
tcc: error: undefined symbol 'photon_init_default'
tcc: error: undefined symbol 'init_photon_work_pool'
builder error: 
==================
C error. This should never happen.

This seems to be more errors than earlier, so it seems like the newly compiled photonwrapper.so didn't help me on this one. I'd be curious to see why @joe-conigliaro was able to compile correctly with the newly compiled photonwrapper.so but I can't. Since I do not have photon lib on my computer, I can't use the build script from the photonbin repo to try to build it myself, unfortunately.

joe-conigliaro commented 4 months ago

This is odd indeed, something else is going on here. its almost like it's completely missed photonwrapper.so. Ill think about this for a little

JalonSolov commented 4 months ago

I got the messages about missing photon_ symbols when I had an old version of photonwrapper.so. After I get the newer version, I only go the 2 GC_ symbols reported.

joe-conigliaro commented 4 months ago

I got the messages about missing photon_ symbols when I had an old version of photonwrapper.so. After I get the newer version, I only go the 2 GC_ symbols reported.

Ohh in your case if you delete thirdparty/tcc & run make it should then work :)

JalonSolov commented 4 months ago

Yep, that did it for tcc!

[jalon@7950x v]$ v -cg -use-coroutines examples/coroutines/simple_coroutines.v
coroutines .so not found, downloading...
done!
[jalon@7950x v]$

and gcc!

[jalon@7950x v]$ v -cg -use-coroutines -cc gcc examples/coroutines/simple_coroutines.v
[jalon@7950x v]$

clang, though? Ouch...

[jalon@7950x v]$ v -cg -use-coroutines -cc clang examples/coroutines/simple_coroutines.v
In file included from /tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:1806:
/home/jalon/git/v/vlib/coroutines/sp_corrector.c:24:5: error: call to undeclared function 'pthread_getattr_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    pthread_getattr_np((pthread_t)tid, &gattr);
    ^
/home/jalon/git/v/vlib/coroutines/sp_corrector.c:24:5: note: did you mean 'pthread_attr_init'?
/usr/include/pthread.h:285:12: note: 'pthread_attr_init' declared here
extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
           ^
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:19011:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t3.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:21712:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t15.data);
   ^~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:21883:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t1.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:21992:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t1.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:22005:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t1.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:22153:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t1.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:22181:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t5.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:22790:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t2.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:27481:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t1.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:28944:4: warning: expression result unused [-Wunused-value]
  (*(os__SignalHandler*)_t3.data);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:34097:4: warning: expression result unused [-Wunused-value]
  (*(os__Result*)_t46.data);
   ^~~~~~~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:35867:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t2.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36204:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t5.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36312:4: warning: expression result unused [-Wunused-value]
  (*(string*)_t1.data);
   ^~~~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36581:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36617:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36647:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36657:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36667:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:36830:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t2.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37201:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t7.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37218:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t11.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37396:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37474:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37504:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37662:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t4.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37868:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t7.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37922:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:37935:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38605:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38614:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38653:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t18.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38662:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t20.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38721:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t38.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38730:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t40.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:38855:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t1.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40500:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t13.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40551:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40560:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40598:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40607:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:40898:4: warning: expression result unused [-Wunused-value]
  (*(bool*)_t7.data);
   ^~~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:41073:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:41605:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t5.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:41913:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t6.data);
   ^~~~~~~~~~~~~~~
/tmp/v_1000/simple_coroutines.01HQ1V6880EB6VMEART2WCMSDG.tmp.c:42337:4: warning: expression result unused [-Wunused-value]
  (*(int*)_t3.data);
   ^~~~~~~~~~~~~~~
46 warnings and 1 error generated.
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

[jalon@7950x v]$
joe-conigliaro commented 4 months ago

@JalonSolov I know what the clang thing is :) Ill get it fixed, there so many different versions of these pthread functions :D

Varpie commented 4 months ago

@JalonSolov it seems like the clang message only has one error, that could be fixed by adding -cflags -D_GNU_SOURCE to your command, as it did for me.

joe-conigliaro commented 4 months ago

Hi @Varpie yeah we can either do that, or use the functions from the clang headers (which i think may be the better long term option, since everything else is expecting those)