yhirose / culebra

Culebra Programming Language
MIT License
5 stars 1 forks source link

Fail to execute example from the readme #1

Closed mingodad closed 2 years ago

mingodad commented 2 years ago

Following the instructions on the readme I can build this project but then when try to execute the example from the readme (or any other sample) I'm getting this error:

make
Scanning dependencies of target culebra
[ 50%] Building CXX object CMakeFiles/culebra.dir/src/main.cc.o
[100%] Linking CXX executable culebra
[100%] Built target culebra

./culebra ../samples/fizzbuzz.cul
Unknown error -1
yhirose commented 2 years ago

@mingodad, thank you for the report. On my MacBook Pro, I get the following result. Could you give you more information about your environment?

~/culebra/build$ ./culebra ../samples/fizzbuzz.cul
1
2
'Fizz'
4
'Buzz'
'Fizz'
7
8
'Fizz'
'Buzz'
11
'Fizz'
13
14
'FizzBuzz'
16
17
'Fizz'
19
'Buzz'
'Fizz'
22
23
mingodad commented 2 years ago

I'm on Ubuntu 18.04 64 bits

uname -a
Linux mingo-X550VX 5.4.0-107-generic #121~18.04.1-Ubuntu SMP Thu Mar 24 17:21:33 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
cmake ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: culebra/build
mingodad commented 2 years ago

The repl at first work but then:

./culebra
cul> puts(12)
Unknown error -1

I'm using the latest cloned repos for cpp-peglib/peglib.h and cpp-linenoise/linenoise.hpp symlinked on culebra/include.

yhirose commented 2 years ago

@mingodad, I just tried it on Ubuntu 20.04 LTS, and the fizzbuzz worked with no problem.

mingodad commented 2 years ago

I went through it with the debugger and found that it was failing on initialize_definition_ids and remembering a mention about needing to link against libpthread on cpp-peglib I added it and now it works.

Strange that it builds fine and silently fails to execute without -lpthread.