Project

Profile

Help

Bug #6297

closed

12.4.1 command build errors on CentOS 7

Added by Tony Graham 12 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Category:
Linux
Start date:
2023-12-19
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
12
Fixed in Maintenance Release:
Found in version:
12.4.1
Fixed in version:
12.5
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Running build-saxonc-commands.sh on CentOS 7 generated errors about the C version, such as:

Transform.c: In function ‘transform’:
Transform.c:33:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 1; i < argc; i++) {
   ^
Transform.c:33:3: note: use option -std=c99 or -std=gnu99 to compile your code

After adding -std=c99 to the GCC command lines, there were errors about int64_t, such as:

In file included from ../Saxon.C.API/SaxonCGlue.c:1:0:
../Saxon.C.API/SaxonCGlue.h:92:3: error: unknown type name ‘int64_t’
   int64_t value; /*!< Internal use only. The value of the parameter points
   ^

That was worked around by adding #include <stdint.h> for __LINUX__ and __APPLE__ in SaxonCGlue.h. I don't know whether #include <stdint.h> would be necessary for __APPLE__.

Also, it's not clear why #include <stdio.h> is included a second time for __LINUX__ and __APPLE__.

--- build-saxonc-commands.sh~	2023-12-01 12:17:46.000000000 +0000
+++ build-saxonc-commands.sh	2023-12-19 08:52:51.329869064 +0000
@@ -4,15 +4,15 @@
 parent_path=$( cd "$(dirname "$0")" ; pwd -P )
 library_dir=${1-$(pwd -P)}/../libs/nix
 #cd "$parent_path"
-gcc -m64 -fPIC -I../Saxon.C.API/graalvm  -c ../Saxon.C.API/SaxonCGlue.c -o SaxonCGlue.o $1
+gcc -std=c99 -m64 -fPIC -I../Saxon.C.API/graalvm  -c ../Saxon.C.API/SaxonCGlue.c -o SaxonCGlue.o $1
 
-gcc -m64 -fPIC -I../Saxon.C.API/graalvm  Transform.c  -o transform -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
+gcc -std=c99 -m64 -fPIC -I../Saxon.C.API/graalvm  Transform.c  -o transform -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
 
-gcc -m64 -fPIC -I../Saxon.C.API/graalvm Query.c -o query -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
+gcc -std=c99 -m64 -fPIC -I../Saxon.C.API/graalvm Query.c -o query -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
 
-gcc -m64 -fPIC -I../Saxon.C.API/graalvm Gizmo.c -o gizmo -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
+gcc -std=c99 -m64 -fPIC -I../Saxon.C.API/graalvm Gizmo.c -o gizmo -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
 
 if [ -f Validate.c ]; then
-    gcc -m64 -fPIC -I../Saxon.C.API/graalvm Validate.c -o validate -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
+    gcc -std=c99 -m64 -fPIC -I../Saxon.C.API/graalvm Validate.c -o validate -ldl -lc SaxonCGlue.o -L$library_dir -lsaxon-hec-12.4.1 $1
 fi
 
--- SaxonCGlue.h~	2023-12-01 12:17:48.000000000 +0000
+++ SaxonCGlue.h	2023-12-19 09:00:42.996931099 +0000
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 #else
 #include <stdint.h>
 #include <windows.h>

Please register to edit this issue

Also available in: Atom PDF