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 statusmake[2]: *** [gsc] Error 1make[1]: *** [all-recursive] Error 1make: *** [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 int, long int, long int, long int, long int)’:os_io.c:3911:20: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissive] 0) ^In file included from os_io.c:12:0:../include/gambit.h:10260:23: note: initializing argument 2 of ‘long int ___SCMOBJ_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**’ [-fpermissive] 0) ^In file included from os_io.c:12:0:../include/gambit.h:10260:23: note: initializing argument 2 of ‘long int ___SCMOBJ_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**’ [-fpermissive] 0) ^In file included from os_io.c:12:0:../include/gambit.h:10260:23: note: initializing argument 2 of ‘long int ___SCMOBJ_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 ___SCMOBJ_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**’ [-fpermissive] 0) ^In file included from os_io.c:12:0:../include/gambit.h:10260:23: note: initializing argument 2 of ‘long int ___SCMOBJ_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 1make[2]: *** Waiting for unfinished jobs....make[1]: *** [all-recursive] Error 1make: *** [from-scratch] Error 2
## compiler versions, in case that's helpful # gcc -vUsing built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapperTarget: x86_64-linux-gnuConfigured 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-gnuThread model: posixgcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
# g++ -vUsing built-in specs.COLLECT_GCC=g++COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapperTarget: x86_64-linux-gnuConfigured 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-gnuThread model: posixgcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Afficher les réponses par date
On 11/27/2016 11:15 PM, Bob Coleman wrote:
# configuring with just the --enable-cplusplus flag gives the errors below: # ./configure --enable-cplusplus
bob@bob-Gazelle:~/GambitSchemeSourceRepo/gambit$ make -j8 from-scratch
This worked for me:
21 14:20 git clone https://github.com/gambit/gambit.git 22 14:21 cd gambit 23 14:21 ./configure 24 14:23 make -j8 latest-release 27 14:25 ./configure 'CC=gcc -march=native' '--enable-single-host' '--enable-shared' '--enable-multiple-versions' 28 14:26 make -j8 from-scratch 29 14:28 make check 30 14:29 make -j doc 31 14:29 sudo make install 35 23:20 ./configure --enable-cplusplus 36 23:20 make mostlyclean 37 23:20 make 38 23:22 make check
I.e., after configuring with my usual options and "make from-scratch" I reconfigured with --enable-cplusplus and then "make; make check" worked.
My gcc/g++:
firefly:~/programs/gambit/gambit> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-5ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --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 --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12) firefly:~/programs/gambit/gambit> g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-5ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --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 --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)
Brad
I could never get your reconfigure trick to work. I keep getting the error below during the last make.
... g++ -Wno-unused -Wno-write-strings -O1 -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -fomit-frame-pointer -fPIC -fno-common -mieee-fp -mpc64 -rdynamic -I"../include" -o "gsi" _gsi.o _gsi_.o "../lib/libgambit.a" -lutil -ldl libgambitgsi.a _gsi_.o: In function `main': _gsi_.c:(.text+0x19): undefined reference to `___main_char' collect2: error: ld returned 1 exit status makefile:178: recipe for target 'gsi' failed make[1]: *** [gsi] Error 1 ...
Fortunately, the changes Marc made to the repo this morning fixed the errors I was getting. I'm able to make from-scratch now with the --enable-cplusplus flag in place.
Thanks for your help!
On Sun, Nov 27, 2016 at 11:27 PM, Bradley Lucier lucier@math.purdue.edu wrote:
On 11/27/2016 11:15 PM, Bob Coleman wrote:
# configuring with just the --enable-cplusplus flag gives the errors below:
# ./configure --enable-cplusplus
bob@bob-Gazelle:~/GambitSchemeSourceRepo/gambit$ make -j8 from-scratch
This worked for me:
21 14:20 git clone https://github.com/gambit/gambit.git 22 14:21 cd gambit 23 14:21 ./configure 24 14:23 make -j8 latest-release 27 14:25 ./configure 'CC=gcc -march=native' '--enable-single-host'
'--enable-shared' '--enable-multiple-versions' 28 14:26 make -j8 from-scratch 29 14:28 make check 30 14:29 make -j doc 31 14:29 sudo make install 35 23:20 ./configure --enable-cplusplus 36 23:20 make mostlyclean 37 23:20 make 38 23:22 make check
I.e., after configuring with my usual options and "make from-scratch" I reconfigured with --enable-cplusplus and then "make; make check" worked.
My gcc/g++:
firefly:~/programs/gambit/gambit> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-5ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --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 --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12) firefly:~/programs/gambit/gambit> g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-5ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --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 --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-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 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)
Brad