Problem building BabylonNative on Linux

I’m getting the following errors building the Linux version on Ubuntu 18.04.

I’m using GNU compilers.

[158/249] Building CXX object Dependencies/glslang/glslang/C…s/MachineIndependent.dir/MachineIndependent/reflection.cpp.o
…/Dependencies/glslang/glslang/MachineIndependent/reflection.cpp: In member function ‘void glslang::TReflection::buildCounterIndices(const glslang::TIntermediate&)’:
…/Dependencies/glslang/glslang/MachineIndependent/reflection.cpp:1127:60: warning: unused parameter ‘intermediate’ [-Wunused-parameter]
void TReflection::buildCounterIndices(const TIntermediate& intermediate)
^~~~~~~~~~~~
[198/249] Building CXX object Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntime.cpp.o
FAILED: Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntime.cpp.o
/usr/bin/g++ -DNODE_ADDON_API_DISABLE_DEPRECATED -DNODE_ADDON_API_DISABLE_NODE_SPECIFIC -DNOMINMAX -I…/Core/AppRuntime/Include/Babylon -I…/Dependencies/arcana.cpp/Source/Submodules/GSL/include -I…/Dependencies/arcana.cpp/Source/Shared -I…/Dependencies/arcana.cpp/Source/Unix -I…/Core/JsRuntime/Include -I…/Dependencies/napi/napi-direct/include -I/usr/include/webkitgtk-4.0 -Wall -Wextra -Wpedantic -Werror -std=gnu++1z -MD -MT Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntime.cpp.o -MF Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntime.cpp.o.d -o Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntime.cpp.o -c …/Core/AppRuntime/Source/AppRuntime.cpp
In file included from /usr/include/c++/7/memory:80:0,
from …/Dependencies/napi/napi-direct/include/napi/napi.h:16,
from …/Dependencies/napi/napi-direct/include/napi/env.h:3,
from …/Core/JsRuntime/Include/Babylon/JsRuntime.h:3,
from …/Core/AppRuntime/Include/Babylon/AppRuntime.h:3,
from …/Core/AppRuntime/Source/AppRuntime.cpp:1:
/usr/include/c++/7/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = Babylon::JsRuntime::InternalState]’:
/usr/include/c++/7/bits/unique_ptr.h:263:17: required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = Babylon::JsRuntime::InternalState; _Dp = std::default_deleteBabylon::JsRuntime::InternalState]’
…/Core/JsRuntime/Include/Babylon/JsRuntime.h:49:56: required from here
/usr/include/c++/7/bits/unique_ptr.h:76:22: error: invalid application of ‘sizeof’ to incomplete type ‘Babylon::JsRuntime::InternalState’
static_assert(sizeof(_Tp)>0,
^
In file included from …/Dependencies/arcana.cpp/Source/Shared/arcana/threading/task.h:34:0,
from …/Core/AppRuntime/Source/WorkQueue.h:4,
from …/Core/AppRuntime/Source/AppRuntime.cpp:2:
…/Dependencies/arcana.cpp/Source/Shared/arcana/threading/internal/internal_task.h:469:49: error: ‘static arcana::basic_expected<void, E> arcana::internal::output_wrapper<void, ErrorT>::invoke(CallableT&&, InputT&& …) [with CallableT = Babylon::WorkQueue::Append(CallableT) [with CallableT = std::function<void(Napi::Env)>]::<lambda()>&; InputT = {}; ErrorT = std::error_code]’, declared using local type ‘Babylon::WorkQueue::Append(CallableT) [with CallableT = std::function<void(Napi::Env)>]::<lambda()>’, is used but never defined [-fpermissive]
static basic_expected<void, ErrorT> invoke(CallableT&& callable, InputT&&… input) noexcept
^~~~~~
[199/249] Building CXX object Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeJavaScriptCore.cpp.o
FAILED: Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeJavaScriptCore.cpp.o
/usr/bin/g++ -DNODE_ADDON_API_DISABLE_DEPRECATED -DNODE_ADDON_API_DISABLE_NODE_SPECIFIC -DNOMINMAX -I…/Core/AppRuntime/Include/Babylon -I…/Dependencies/arcana.cpp/Source/Submodules/GSL/include -I…/Dependencies/arcana.cpp/Source/Shared -I…/Dependencies/arcana.cpp/Source/Unix -I…/Core/JsRuntime/Include -I…/Dependencies/napi/napi-direct/include -I/usr/include/webkitgtk-4.0 -Wall -Wextra -Wpedantic -Werror -std=gnu++1z -MD -MT Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeJavaScriptCore.cpp.o -MF Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeJavaScriptCore.cpp.o.d -o Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeJavaScriptCore.cpp.o -c …/Core/AppRuntime/Source/AppRuntimeJavaScriptCore.cpp
In file included from /usr/include/c++/7/memory:80:0,
from …/Dependencies/napi/napi-direct/include/napi/napi.h:16,
from …/Dependencies/napi/napi-direct/include/napi/env.h:3,
from …/Core/JsRuntime/Include/Babylon/JsRuntime.h:3,
from …/Core/AppRuntime/Include/Babylon/AppRuntime.h:3,
from …/Core/AppRuntime/Source/AppRuntimeJavaScriptCore.cpp:1:
/usr/include/c++/7/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = Babylon::JsRuntime::InternalState]’:
/usr/include/c++/7/bits/unique_ptr.h:263:17: required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = Babylon::JsRuntime::InternalState; _Dp = std::default_deleteBabylon::JsRuntime::InternalState]’
…/Core/JsRuntime/Include/Babylon/JsRuntime.h:49:56: required from here
/usr/include/c++/7/bits/unique_ptr.h:76:22: error: invalid application of ‘sizeof’ to incomplete type ‘Babylon::JsRuntime::InternalState’
static_assert(sizeof(_Tp)>0,
^
[201/249] Building CXX object Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeUnix.cpp.o
FAILED: Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeUnix.cpp.o
/usr/bin/g++ -DNODE_ADDON_API_DISABLE_DEPRECATED -DNODE_ADDON_API_DISABLE_NODE_SPECIFIC -DNOMINMAX -I…/Core/AppRuntime/Include/Babylon -I…/Dependencies/arcana.cpp/Source/Submodules/GSL/include -I…/Dependencies/arcana.cpp/Source/Shared -I…/Dependencies/arcana.cpp/Source/Unix -I…/Core/JsRuntime/Include -I…/Dependencies/napi/napi-direct/include -I/usr/include/webkitgtk-4.0 -Wall -Wextra -Wpedantic -Werror -std=gnu++1z -MD -MT Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeUnix.cpp.o -MF Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeUnix.cpp.o.d -o Core/AppRuntime/CMakeFiles/AppRuntime.dir/Source/AppRuntimeUnix.cpp.o -c …/Core/AppRuntime/Source/AppRuntimeUnix.cpp
In file included from /usr/include/c++/7/memory:80:0,
from /usr/include/c++/7/thread:39,
from …/Dependencies/arcana.cpp/Source/Shared/arcana/threading/affinity.h:4,
from …/Dependencies/arcana.cpp/Source/Shared/arcana/threading/dispatcher.h:6,
from …/Core/AppRuntime/Source/WorkQueue.h:3,
from …/Core/AppRuntime/Source/AppRuntimeUnix.cpp:1:
/usr/include/c++/7/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = Babylon::JsRuntime::InternalState]’:
/usr/include/c++/7/bits/unique_ptr.h:263:17: required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = Babylon::JsRuntime::InternalState; _Dp = std::default_deleteBabylon::JsRuntime::InternalState]’
…/Core/JsRuntime/Include/Babylon/JsRuntime.h:49:56: required from here
/usr/include/c++/7/bits/unique_ptr.h:76:22: error: invalid application of ‘sizeof’ to incomplete type ‘Babylon::JsRuntime::InternalState’
static_assert(sizeof(_Tp)>0,
^
[203/249] Building CXX object Core/ScriptLoader/CMakeFiles/ScriptLoader.dir/Source/ScriptLoader.cpp.o
ninja: build stopped: subcommand failed.

@bghgary I am pretty sure this one is for you :slight_smile: as I do not understand anything about it :slight_smile:

BN on Linux has been tested with Clang8+ and GCC9
What’s your compiler and its version? Also, can you try with a more recent libc++ like V8 instead of V7

I’m using an older version of GCC. I will try upgrading. Having a publically available docker image with all the build dependency would be awesome. Building the right image is turning out to be very painful.

I got it building. Switching from ubuntu 18 to 20 made things much easier. Here’s my Dockerfile:

FROM ubuntu:groovy

ENV CC=/usr/bin/clang

ENV CXX=/usr/bin/clang++

RUN apt update

RUN apt upgrade -y

RUN apt-get install apt-utils libjavascriptcoregtk-4.0-dev libgl1-mesa-dev libcurl4-openssl-dev clang cmake libc++-dev libc++abi-dev lld-8 ninja-build git wget software-properties-common -y

ADD . /build/
2 Likes

Sweet! Does it run on your server?

No, Segmentation Fault with no additional info. But I’m running in docker on my local Mac, and I don’t think docker makes the GPU available to perhaps it is because there is no GPU.

Can you get a callstack with gdb or lldb ?

Yup. I’ll try to get a callstack.

How do you build with symbols?

AFAIK, builds contain symbol. You have to strip the ELF to remove symbols.

When I run using gdb this is what I get.

(gdb) run

Starting program: /build/build/Apps/ValidationTests/ValidationTests

warning: Error disabling address space randomization: Operation not permitted

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

[New Thread 0x7f4258eac640 (LWP 708)]

Thread 1 "ValidationTests" received signal SIGSEGV, Segmentation fault.

0x000000000040e197 in main ()

And when I load ValidationTests it says no symbols.

Reading symbols from ValidationTests...

(No debugging symbols found in ValidationTests)

and if you type bt in gdb once it’s crashed, do you get something?

(gdb) bt 10
#0  0x000000000040e197 in main ()

So it seems like it is crashing in main, but I have no line number.

For Linux builds, do the CI build and tests run in Azure?

Can you try to regenerate ninja build scripts with CMake and add -DCMAKE_BUILD_TYPE=Debug to the command line.
Something like:

cmake -GNinja -DJSCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.0.so -DCMAKE_BUILD_TYPE=Debug ..

Ok. I’ll try that.

Yes, the Linux build is tested on the CI. Currently disabled for other reasons but I tested that it works last Friday.