[Glass] GemBuilder for C compilation on 3.6.1

Iwan Vosloo iwan at reahl.org
Sun Jun 20 01:39:13 PDT 2021


Hi all,

I am trying to compile C code that calls GemBuilder for C functions.
I take inspiration from 
https://downloads.gemtalksystems.com/docs/GemStone64/3.6.x/GS64-GemBuilderforC-3.6.pdf 
sections 5.2 and 5.3.

I am doing this on Ubuntu 20.04, using g++ 9.3.0 all of which are 
supported according to the above doc.

I also have installed GemStone64Bit3.6.1-x86_64.Linux

I have a simplified test program that just calls a simple function from 
libgcits. I can compile and link, but when I run the resultant program 
it segfaults when I callthe Gci function. I have to confess that I 
haven't touched C in 20 years, so I am probably doing stupid things. (I 
had this working with GemStone 3.4.1)

Here is my program (test.c):

#include <stdio.h>
#include <gcits.hf>

int main() {
   const char *unencrypted_password = "abcde";
   char *out_buff;
   char *encrypted_password;
   int encrypted_char;
   unsigned int out_buff_size = 1000;
   out_buff = (char *)malloc(out_buff_size * sizeof(char));
   GciTsEncrypt(unencrypted_password, out_buff, out_buff_size);
   free(out_buff);
   return 0;
}

I build it using this makefile:

COMPILE_FLAGS=-fmessage-length=0 -fcheck-new -O3 -ggdb -m64 -pipe \
               -D_REENTRANT -D_GNU_SOURCE -pthread -fPIC \
               -fno-strict-aliasing -fno-exceptions -x c++

LINK_FLAGS=-m64 -Wl,-Bdynamic,--no-as-needed -lpthread -Wl,--as-needed \
            -lcrypt -ldl -lc -lm -lrt -Wl,-traditional -Wl,-z,lazy

all:
	g++ -I${GEMSTONE}/include ${COMPILE_FLAGS} -c test.c -o test.o
	g++ -L${GEMSTONE}/lib -lgcits-3.6.1-64 ${LINK_FLAGS} test.o -o test


The options above are taken from 5.3 of the doc, except that I link 
gcits-3.6.1-64 library directly instead of using the run time loading as 
is explained earlier in the doc.

What am I missing here?

Regards
Iwan

-- 




More information about the Glass mailing list