CauldronDevelopmentLLC / cbang

C! (cbang) is a library for cross-platform C++ development.
GNU Lesser General Public License v2.1
57 stars 41 forks source link

Having trouble building with v8 #34

Closed hpmachining closed 5 years ago

hpmachining commented 5 years ago

I have been building cbang with v8 3.14. Commit d846adb3a293dcce7271ea20c80c7dcfdf4404df was the last commit that works for me. I tried building using v8 7.4 but cbang is not finding the libs. Here is the configure output:

scons: Reading SConscript files ...
   Compiler: gcc (gnu)
   Platform: posix
       Mode: gnu
       Arch: x86
GCC Version: 8.3.0
       Jobs: 8
Checking for C library pthread... yes
Checking for C header file zlib.h... yes
Checking for C library z... yes
Checking for C header file bzlib.h... yes
Checking for C library bz2... yes
Checking for C header file expat.h... yes
Checking for C library expat... yes
Checking for C header file pthread.h... yes
Checking for C library pthread... yes
Checking for C library dl... yes
Checking for C library sqlite3... yes
Checking for C header file sqlite3.h... yes
Checking for C function sqlite3_backup_init()... yes
Checking for C header file event.h... yes
Checking for C library event... yes
Checking for C++ header file re2/re2.h... yes
Checking for C library re2... yes
Checking for C header file yaml.h... yes
Checking for C library yaml... yes
Checking for C library leveldb... no
Checking for C header file mysql/mysql.h... no
Checking for C function clock_gettime()... yes
Checking for C library dl... yes
Checking for C header file openssl/ssl.h... yes
Checking for C library crypto... yes
Checking for C library ssl... yes
Checking for openssl version >= 1.0.0...yes
Checking for C++ header file ChakraCore.h... no
Need C++ header ChakraCore.h(cached) error: no result
Checking for C++ header file v8.h... yes
Checking for C++ header file libplatform/libplatform.h... yes
Checking for C library v8... no
Checking for C library v8_snapshot... no
Need library v8_snapshot(cached) error: no result
Checking for C header file pthread.h... yes
Checking for C library pthread... yes
Checking for C header file valgrind/valgrind.h... no

Here is the list of files installed with the v8 7.4 package I am trying to use:

/usr/
/usr/bin/
/usr/bin/d8
/usr/include/
/usr/include/libplatform/
/usr/include/libplatform/libplatform-export.h
/usr/include/libplatform/libplatform.h
/usr/include/libplatform/v8-tracing.h
/usr/include/v8-inspector-protocol.h
/usr/include/v8-inspector.h
/usr/include/v8-internal.h
/usr/include/v8-platform.h
/usr/include/v8-profiler.h
/usr/include/v8-testing.h
/usr/include/v8-util.h
/usr/include/v8-value-serializer-version.h
/usr/include/v8-version-string.h
/usr/include/v8-version.h
/usr/include/v8-wasm-trap-handler-posix.h
/usr/include/v8-wasm-trap-handler-win.h
/usr/include/v8.h
/usr/include/v8config.h
/usr/lib/
/usr/lib/libv8_for_testing.so
/usr/lib/libv8_libbase.so
/usr/lib/libv8_libplatform.so
/usr/lib/pkgconfig/
/usr/lib/pkgconfig/v8.pc
/usr/lib/pkgconfig/v8_libbase.pc
/usr/lib/pkgconfig/v8_libplatform.pc
/usr/lib/v8/
/usr/lib/v8/cctest
/usr/lib/v8/d8
/usr/lib/v8/icudtl.dat
/usr/lib/v8/libc++.so
/usr/lib/v8/libicui18n.so
/usr/lib/v8/libicuuc.so
/usr/lib/v8/libv8.so
/usr/lib/v8/natives_blob.bin
/usr/lib/v8/snapshot_blob.bin
/usr/share/
/usr/share/licenses/
/usr/share/licenses/v8/
/usr/share/licenses/v8/LICENSE
/usr/share/licenses/v8/LICENSE.fdlibm
/usr/share/licenses/v8/LICENSE.strongtalk
/usr/share/licenses/v8/LICENSE.v8
/usr/share/licenses/v8/LICENSE.valgrind

Do you have any suggestions or procedures to use to get this working with v8 again?

jcoffland commented 5 years ago

Debian started installing the package libnode-dev instead of libv8-dev when I try to install the latter. Perhaps it would install the real libv8-dev if I completely uninstalled node but I need node. So, I modified cbang to use the version of v8 that comes with libnode-dev which is 6.8. I've been considering supporting both versions but it would be better to use the more modern v8 if possible. Can you use v8 6.8?

hpmachining commented 5 years ago

I’ll look into it. I don’t have a package or build script for that version, but I’ll see if I can make one.

hpmachining commented 5 years ago

Using v8 6.8 worked for building cbang. It looks like CAMotics hasn't been updated yet to build with this latest cbang. Is this correct?

jcoffland commented 5 years ago

I just pushed a few commits I had on my local machine. It should build now. Let me know if it does not.

hpmachining commented 5 years ago

Looks like I have a few issues to work out with my v8 6.8 build. I have a lot of linker issues trying to build CAMotics, most seem to be looking for an older icu that was bundled with v8. Once I get that sorted out I'll let you know. Thank you.

hpmachining commented 5 years ago

I have most of my v8 issues sorted out. CAMotics itself builds and links, but I still have a linker error with tplang when building. I don't know if this is an issue with my v8 build or with cbang code. Let me know for sure that it works with the Debian v8 that is packaged with libnode. Here is the linker error I am getting:

g++ -o tplang -Wl,--as-needed -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-S -Wl,-x -no-pie -pthread -Wl,-rpath=/usr/lib build/tplang.o -L/opt/cbang/lib build/libCAMotics.a build/libCAMoticsGUI.a build/libclipper.a build/libDXF.a build/libSTL.a build/libGCode.a -lstdc++ -lcbang -lcbang-boost -lv8 -lssl -lcrypto -ldl -lexpat -lbz2 -lz -lpthread build/dxflib/libdxflib.a
/usr/bin/ld: /opt/cbang/lib/libcbang.a(JSImpl.o): in function `cb::gv8::JSImpl::init(int*, char**)':
(.text+0x34c): undefined reference to `v8::platform::CreateDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, v8::TracingController*)'
collect2: error: ld returned 1 exit status
scons: *** [tplang] Error 1
scons: building terminated because of errors.

Thank you.

jcoffland commented 5 years ago

It looks like your libv8 build is missing the function v8::platform::CreateDefaultPlatform(). You may also need to link with libv8_libplatform.so. Try this:

scons linkflags=-lv8_libplatform
hpmachining commented 5 years ago

scons linkflags=-lv8_libplatform didn't work. I think it has to do with the -Wl, --as-needed option. If I remove the option from the cbang/config/compiler/__init__.py file I can build CAMotics using the linkflags= option to add the library. However, if I just add conf.CBRequireLib('v8_libplatform') to the cbang/config/v8/__init__.py file, I can build without removing the --as-needed option, or having to add the library using the linkflags= option. I don't know why this is, but this is what worked for me.

jcoffland commented 5 years ago

I think this is a link order problem.