Hello,

I'm trying to create a simple Gambit wrapper for the opencv library.  Opencv is written in C++ so I tried to build Gambit with the --enable-cplusplus flag.  I was hoping this would be easier than trying to build a Gambit wrapper around a C wrapper around opencv, but I haven't been able to Gambit to build with the C++ option.  I have no problems building Gambit with gcc, but g++ gives the errors below.

Is there more to a C++ build that I may be missing?  Is there an easier way to wrap a C++ library?  I included my compiler versions below as well.

Thanks for you help,
Bob


# configuring with just the --enable-cplusplus flag gives the errors below:
# ./configure --enable-cplusplus

bob@bob-Gazelle:~/GambitSchemeSourceRepo/gambit$ make -j8 from-scratch
...
libgambitgsc.a(_source.o): In function `___H_c_23__2a__2a_readtable_2d_string_2d_convert_2d_case_21_':
_source.c:(.text+0xde0b): undefined reference to `___towupper'
_source.c:(.text+0xdeca): undefined reference to `___towlower'
libgambitgsc.a(_source.o): In function `___H_c_23__2a__2a_readtable_2d_convert_2d_case':
_source.c:(.text+0xdfc9): undefined reference to `___towupper'
_source.c:(.text+0xdfdd): undefined reference to `___towlower'
libgambitgsc.a(_front.o): In function `___H_c_23_valid_2d_module_2d_name_3f_':
_front.c:(.text+0x268c1): undefined reference to `___iswspace'
libgambitgsc.a(_asm.o): In function `___H___asm_23_asm_2d_float_2d__3e_exact_2d_exponential_2d_format':
_asm.c:(.text+0x24b24): undefined reference to `___isfinite'
_asm.c:(.text+0x24b37): undefined reference to `___trunc'
collect2: error: ld returned 1 exit status
make[2]: *** [gsc] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [from-scratch] Error 2



# configuring with my typical options plus --enable-cplusplus gives a different
# set of errors
#./configure --enable-single-host --enable-cplusplus --enable-c-opt --enable-gcc-opts --enable-openssl

bob@bob-Gazelle:~/GambitSchemeSourceRepo/gambit$ make -j8 from-scratch
...
os_io.c: In function ‘long int ___release_rc_tls_context(void*)’:
os_io.c:3705:23: error: invalid conversion from ‘void*’ to ‘___tls_context* {aka
 ___tls_context_t*}’ [-fpermissive]
   ___tls_context *c = x;
                       ^
os_io.c: In function ‘long int ___os_make_tls_context(long int, long int, long i
nt, long int, long int, long int, long int)’:
os_io.c:3911:20: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissiv
e]
                   0)
                    ^
In file included from os_io.c:12:0:
../include/gambit.h:10260:23: note:   initializing argument 2 of ‘long int ___SC
MOBJ_to_STRING(long int, void**, int, int, int)’
 ___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
                       ^
../include/gambit.h:1554:43: note: in definition of macro ‘___IMP_FUNC’
 #define ___IMP_FUNC(type,name)extern type name
                                           ^
os_io.c:3919:20: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissiv
e]
                   0)
                    ^
In file included from os_io.c:12:0:
../include/gambit.h:10260:23: note:   initializing argument 2 of ‘long int ___SC
MOBJ_to_STRING(long int, void**, int, int, int)’
 ___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
                       ^
../include/gambit.h:1554:43: note: in definition of macro ‘___IMP_FUNC’
 #define ___IMP_FUNC(type,name)extern type name
                                           ^
os_io.c:3927:20: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissiv
e]
                   0)
                    ^
In file included from os_io.c:12:0:
../include/gambit.h:10260:23: note:   initializing argument 2 of ‘long int ___SC
MOBJ_to_STRING(long int, void**, int, int, int)’
 ___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
                       ^
../include/gambit.h:1554:43: note: in definition of macro ‘___IMP_FUNC’
 #define ___IMP_FUNC(type,name)extern type name
                                           ^
In file included from os_io.c:12:0:
../include/gambit.h:10260:23: note:   initializing argument 2 of ‘long int ___SC
MOBJ_to_STRING(long int, void**, int, int, int)’
 ___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
                       ^
../include/gambit.h:1554:43: note: in definition of macro ‘___IMP_FUNC’
 #define ___IMP_FUNC(type,name)extern type name
                                           ^
os_io.c:3941:20: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissiv
e]
                   0)
                    ^
In file included from os_io.c:12:0:
../include/gambit.h:10260:23: note:   initializing argument 2 of ‘long int ___SC
MOBJ_to_STRING(long int, void**, int, int, int)’
 ___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
                       ^
../include/gambit.h:1554:43: note: in definition of macro ‘___IMP_FUNC’
 #define ___IMP_FUNC(type,name)extern type name
                                           ^
make[2]: *** [os_io.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-recursive] Error 1
make: *** [from-scratch] Error 2


## compiler versions, in case that's helpful

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 


# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)