CauldronDevelopmentLLC / cbang

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

V8_ENABLE_SANDBOX must be defined for default builds of v8 version > 10.8 #117

Open hpmachining opened 1 year ago

hpmachining commented 1 year ago

I was getting a crash in CAMotics when building cbang against the latest V8 in arch linux. Embedder-vs-V8 build configuration mismatch. On embedder side sandbox is DISABLED while on V8 side it's ENABLED.

According to this link, the default build configuration was changed in V8 version 10.8. The maintainer for the Arch v8-r package that I am building against was not enabling it until the latest release, 11.4.71, so I haven't had an issue until now. I can fix it on my end with this patch, but I think it should probably be in an if block depending on the v8 version being used.

--- a/src/cbang/js/v8/V8.h      2023-04-12 13:01:26.846888687 -0400
+++ b/src/cbang/js/v8/V8.h      2023-04-12 13:02:23.030223080 -0400
@@ -41,5 +41,6 @@
 #define V8STDINT_H_

 #define V8_ENABLE_CHECKS
+#define V8_ENABLE_SANDBOX

 #include <v8.h>

I haven't done extensive testing, just built and ran the camotics.tpl simulation in CAMotics, and that worked.

jcoffland commented 1 year ago

You could also just add this to your ccflags when building.

hpmachining commented 1 year ago

I tried setting the cxxflags and was having issues. I’ll try again with the ccflags. Thank you.

EDIT: That didn't make any difference. For some reason, when that define is added to the build line, cbang isn't finding V8. For reference, here is my complete build line: scons ccflags="-DV8_ENABLE_SANDBOX" cxxstd="c++17" disable_local="libevent sqlite3 re2 libyaml zlib bzip2 expat"

and here is from the build log: Checking for C++ header file v8.h... no