Giter VIP home page Giter VIP logo

Comments (18)

spytheman avatar spytheman commented on June 24, 2024 2

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

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024 1

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.

from v.

Varpie avatar Varpie commented on June 24, 2024 1

@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.

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024 1

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)

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024

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.

from v.

Varpie avatar Varpie commented on June 24, 2024

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?)

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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.

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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]$

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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]$ 

from v.

Varpie avatar Varpie commented on June 24, 2024

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

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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

from v.

Varpie avatar Varpie commented on June 24, 2024

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'

from v.

Varpie avatar Varpie commented on June 24, 2024

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.

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024

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

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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.

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024

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 :)

from v.

JalonSolov avatar JalonSolov commented on June 24, 2024

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]$

from v.

joe-conigliaro avatar joe-conigliaro commented on June 24, 2024

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

from v.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.