Comments (18)
I just want to thank you for the detailed investigation 🙇🏻♂️ .
from v.
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.
@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.
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.
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.
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.
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.
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.
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.
It's odd that V didn't try to download photonwrapper.so
again after you deleted it, since you use -use-coroutines
...
from v.
Oh, it did, but in an intermediate run... that part worked.
from v.
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.
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.
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.
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.
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 2GC_
symbols reported.
Ohh in your case if you delete thirdparty/tcc
& run make
it should then work :)
from v.
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.
@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)
- Confusing error message when using `is` with a constant rvalue HOT 4
- Data corruption when initializing struct with 2-dimensional array of structs as a member HOT 4
- Better error message for memory allocation in vplayground HOT 1
- vlib: http.Server: different behavior between prod and non-prod for *invalid* Response object
- Builder error: bad map usage
- Different markdown rendering for enumerated list in module documentation HOT 2
- toml.parse_file does not panic when the file is missing HOT 2
- Will vweb have built-in Api document generation tools HOT 2
- Optional type matches incorrectly in $for field
- error: invalid operand types for binary operation, error: invalid aggregate type for register load HOT 2
- documentation generator seems to be off
- autofree: memory leak HOT 1
- Buffered Reader read_line() segfault when compiled with -prod HOT 4
- Strange error message with `@[flag]` enum
- `@[flag]` enums should support all 4 bitwise operators, instead of only 2
- add .args to compile time method HOT 4
- fmt: `i++ $if abc ? {` gets formatted, as `i++$ if abc ? {`, and fails to parse.
- typed fns do not match correctly in compile time code
- libpthread linked always HOT 2
- outdated official toml test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.