Skip to content

Instantly share code, notes, and snippets.

@cheery

cheery/demo.js

Created Oct 28, 2012
Embed
What would you like to do?
Bug with Raspberry pi, EGL and node.js.
console.log("loading bagu");
var bagu = require("./build/Release/bagu");
console.log("bagu loaded");
console.log(bagu);
import ctypes
gl = ctypes.CDLL('libGLESv2.so')
egl = ctypes.CDLL('libEGL.so')
d = egl.eglGetDisplay(0);
print d
print gl
print egl
#1
#<CDLL 'libGLESv2.so', handle 21ed790 at 21c4190>
#<CDLL 'libEGL.so', handle 21f6e58 at 21c4ff0>
#include <v8.h>
#include <node.h>
extern "C" {
#include "EGL/egl.h"
#include "EGL/eglext.h"
#include "GLES2/gl2.h"
}
using namespace v8;
Handle<Value> Demonstrate(const Arguments& args) {
HandleScope scope;
return Undefined();
}
static void Init(Handle<Object> target) {
printf("Init()\n");
EGLDisplay egl = eglGetDisplay(EGL_DEFAULT_DISPLAY);
printf("Init().1\n");
target->Set(String::NewSymbol("demonstrate"),
FunctionTemplate::New(Demonstrate)->GetFunction());
printf("Init().exit\n");
}
NODE_MODULE(bagu, Init)
node-waf configure build
node demo.js
#Setting srcdir to : /home/pi/node-egl-bagu
#Setting blddir to : /home/pi/node-egl-bagu/build
#Checking for program g++ or c++ : /usr/bin/g++
#Checking for program cpp : /usr/bin/cpp
#Checking for program ar : /usr/bin/ar
#Checking for program ranlib : /usr/bin/ranlib
#Checking for g++ : ok
#Checking for node path : not found
#Checking for node prefix : ok /usr
#'configure' finished successfully (0.722s)
#Waf: Entering directory `/home/pi/node-egl-bagu/build'
#Waf: Leaving directory `/home/pi/node-egl-bagu/build'
#'build' finished successfully (0.080s)
#loading bagu
#Init()
#Init().1
#Segmentation fault
# bagu/wscript
import Options
def set_options(opt):
opt.tool_options("compiler_cxx")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
obj.cxxflags = [
"-I/opt/vc/include/",
"-I/opt/vc/include/interface/vcos/pthreads",
# "-I/home/pi/node-video/rpi/include/",
# "-DSTANDALONE",
# "-D__STDC_CONSTANT_MACROS",
# "-D__STDC_LIMIT_MACROS",
# "-DTARGET_POSIX",
# "-D_LINUX",
# "-fPIC",
# "-DPIC",
# "-D_REENTRANT",
# "-D_LARGEFILE64_SOURCE",
# "-D_FILE_OFFSET_BITS=64",
# "-U_FORTIFY_SOURCE",
# "-Wall",
# "-g",
# "-DHAVE_LIBOPENMAX=2",
# "-DOMX",
# "-DOMX_SKIP64BIT",
# "-ftree-vectorize",
# "-pipe",
# "-DUSE_EXTERNAL_OMX",
# "-DHAVE_LIBBCM_HOST",
# "-DUSE_EXTERNAL_LIBBCM_HOST",
# "-DUSE_VCHIQ_ARM",
# "-Wno-psabi",
]
obj.linkflags = [
"-L/opt/vc/lib/",
"-lEGL",
"-lGLESv2",
# "-lbcm_host",
# "-lvcos",
# "-lvchiq_arm",
#"-lvideo",
]
obj.target = "bagu"
obj.source = "init.cc"
@tmpvar

This comment has been minimized.

Copy link

@tmpvar tmpvar commented Oct 31, 2012

@cheery running into the same thing, I noticed you are not calling bcm_host_init() before egl*.. but it dies in a similar way even when I do that.

I would love to get this figured out, let me know if you've found anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment