Reputation: 140
I am trying to compile a static library which uses serial communications on Linux, and it fails with the following errors:
gcc -o out/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/uart.o -c -std=gnu99 -Wall -ggdb -fPIC -Os -Wall -fPIC -pthread -m64 -DNDEBUG -DWITH_POSIX -D__linux__ -DWIFI_ADAPTER -DETHERNET_ADAPTER -DNO_EDR_ADAPTER -DNO_LE_ADAPTER -DMULTI_THREAD -D_XOPEN_SOURCE=600 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/api -Iservice/protocol-plugin/plugins/ble/lib/api -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Ideps/linux/include -Iextlibs/cereal/include -Iextlibs/cereal/cereal/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/inc -Iservice/protocol-plugin/plugins/ble/lib/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iservice/protocol-plugin/plugins/ble/lib/lib/libcoap-4.1.1 -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/common/inc -Iservice/protocol-plugin/plugins/ble/lib/common/inc -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iservice/protocol-plugin/plugins/ble/lib/bluegiga/common/inc -Iresource -Iresource/include -Iresource/oc_logger/include -Iresource/csdk/stack/include -Iresource/csdk/ocrandom/include -Iresource/csdk/logger/include -Iout/linux/x86_64/release/service/protocol-plugin/plugins/ble/lib/bluegiga -Iservice/protocol-plugin/plugins/ble/lib/bluegiga service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c: In function 'uart_open':
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:287:52: error: 'CRTSCTS' undeclared (first use in this function)
options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS | HUPCL);
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:74: error: 'ECHOCTL' undeclared (first use in this function)
...
service/protocol-plugin/plugins/ble/lib/bluegiga/uart.c:289:84: error: 'ECHOPRT' undeclared (first use in this function)
...
I've searched around for this issue, and the only information I could find was here: CRTSCTS not define when compiling as C99
Unfortunately, the solution (using -std=gnu99
) didn't work for me.
Here is some environment information:
$ gcc --version
$ gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
$ uname -r
$ 3.13.0-48-generic
Upvotes: 2
Views: 1480
Reputation: 140
The problem was the -D_XOPEN_SOURCE=600
part of the gcc command. After removing it, everything compiled without problems.
The more detailed explanation can be found in the answer to the question I linked to.
Upvotes: 3