RosettaCommons / rosetta

The Rosetta Bio-macromolecule modeling package.
https://www.rosettacommons.org
Other
116 stars 55 forks source link

flex-generated code - function read not declared from unistd #31

Closed smoe closed 5 months ago

smoe commented 6 months ago
gcc -o build/external/release/linux/5.15/64/x86/gcc/14/default/cifparse/CifScanner.os -c -std=c99 -isystem external/boost_submod/ -isystem external/ -isystem external/include/ -isystem external/dbio/ -isystem external/libxml2/include -isystem external/rdkit -pipe -Wno-long-long -Wno-strict-aliasing -march=core2 -mtune=generic -O3 -ffast-math -fno-finite-math-only -funroll-loops -finline-functions -finline-limit=20000 -s -Wno-unused-variable -Wno-unused-parameter -DPOSIX_MISTAKE -fPIC -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DBOOST_DISABLE_THREADS -DPTR_STD -DNDEBUG -Iexternal/include external/cifparse/CifScanner.c
gcc -o build/external/release/linux/5.15/64/x86/gcc/14/default/cifparse/DICScanner.os -c -std=c99 -isystem external/boost_submod/ -isystem external/ -isystem external/include/ -isystem external/dbio/ -isystem external/libxml2/include -isystem external/rdkit -pipe -Wno-long-long -Wno-strict-aliasing -march=core2 -mtune=generic -O3 -ffast-math -fno-finite-math-only -funroll-loops -finline-functions -finline-limit=20000 -s -Wno-unused-variable -Wno-unused-parameter -DPOSIX_MISTAKE -fPIC -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DBOOST_DISABLE_THREADS -DPTR_STD -DNDEBUG -Iexternal/include external/cifparse/DICScanner.c
<stdout>: In function 'yy_get_next_buffer':
<stdout>:1470:20: error: implicit declaration of function 'read'; did you mean 'fread'? [-Wimplicit-function-declaration]
<stdout>:1960:3: note: in expansion of macro 'YY_INPUT'
<stdout>: In function 'yy_get_next_buffer':
<stdout>:1503:20: error: implicit declaration of function 'read'; did you mean 'fread'? [-Wimplicit-function-declaration]
<stdout>:2022:3: note: in expansion of macro 'YY_INPUT'
scons: `libxml2' is up to date.
scons: `libzmq' is up to date.

I addressed that via

diff --git a/source/external/cifparse/CifScanner.c b/source/external/cifparse/CifScanner.c
index e83af0e946..74e79f4c73 100644
--- a/source/external/cifparse/CifScanner.c
+++ b/source/external/cifparse/CifScanner.c
@@ -1366,6 +1366,7 @@ char *cifparser_text;
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include "CifScannerInt.h"
 #include "CifParser.h"

diff --git a/source/external/cifparse/DICScanner.c b/source/external/cifparse/DICScanner.c
index 04ddc7c3a1..9d6fb1f09c 100644
--- a/source/external/cifparse/DICScanner.c
+++ b/source/external/cifparse/DICScanner.c
@@ -40,6 +40,7 @@
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>

 /* end standard C headers. */

which admittedly was suggested by chatGPT.

roccomoretti commented 5 months ago

The extra include should be good, if it fixes the issue on your machine.. The CifScanner.c and DICScanner.c are hosted in the repo (not generated by the build system), so if you want to submit a PR, that would be appreciated.