Compile failed on FreeBSD
fs_serial.c:57:12: error: use of undeclared identifier 'B576000'
57 | return B576000;
| ^
fs_serial.c:63:12: error: use of undeclared identifier 'B1152000'
63 | return B1152000;
| ^
2 errors generated.
Only baud rates from B300 to B38400 are defined by POSIX. In Linux additional baud rates are defined, which I included in SmallBASIC, because 38400 bauds is too slow. Every Arduino can communicate much faster using serial connection. In OpenBSD and FreeBSD B300 to B38440 are defined, too, and additional some faster modes. But it seems not the same as in Linux. @chrisws : Do you think it is a good idea to uses #ifdef to check, whether a baud rate is defined? Would maybe look a little bit ugly.
@Curculigo : If you want to have a quick fix, so that you can build SmallBASIC, then edit the file SmallBASIC/src/common/fs_serial.c and remove everything (including) line 45 to 75. This will remove all non-POSIX baud rates.
adding an #ifdef for one of the baud rate codes (to assume all or nothing) seems the simplest fix. it doesn't seem to be worth adding some handling in the configure script for this issue.
Now it's unable to find pcre.h. pcre.h is in /usr/local/include. I passed CXXFLAGS="-I/usr/local/include" before running the configure script and the configure script has picked it:
Before:
Building Unix console version.
CFLAGS=-g -O2 -std=gnu11
CXXFLAGS=-g -O2
PACKAGE_LIBS= -lm -ldl -lpthread -L/usr/local/lib -Wl,-R/usr/local/lib -lpcre
After:
Building Unix console version.
CFLAGS=-g -O2 -std=gnu11
CXXFLAGS=-I/usr/local/include
PACKAGE_LIBS= -lm -ldl -lpthread -L/usr/local/lib -Wl,-R/usr/local/lib -lpcre
But it still fails to find pcre.h. Btw, I noticed that -g -O2 is removed after I passed my own CXXFLAGS. I want to append CXXFLAGS, not replace it. How can I do that?
What output did you get when running configure ?
You should see something like
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pcre-config... yes
This uses pcre-config --libs to setup the include path accordingly.
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether byte ordering is bigendian... no
./configure: line 7046: g++: command not found
checking for pcre-config... yes
ah - i see it's setting the lib path but not the include path. also the g++ error is from building keywords. looks like you still need to install the gnu c++ compiler - or maybe you have something else?
The default compiler on FreeBSD is LLVM Clang.