svalaskevicius/qtjs-generator

Link errors while building on mac

Closed this issue · 10 comments

Hi, I am very interested in trying this project out and tried to build the code using the instructions provided on the homepage ( i am on a mac and using Qt 5.3). I get a few link errors when building the cpgf library after running 'make':

Undefined symbols for architecture x86_64:
"v8::HandleScope::CreateHandle(v8::internal::Isolate_, v8::internal::Object_)", referenced from:
cpgf::(anonymous namespace)::GV8ScriptObject::getScriptFunction(char const_) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::invokeIndirectly(char const_, cpgf::GVariant const* const_, unsigned long) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::assignValue(char const_, char const_) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::maybeIsScriptArray(char const_) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::getAsScriptArray(char const_) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::createScriptArray(char const_) in gv8bind.cpp.o
cpgf::(anonymous namespace)::GV8ScriptObject::doGetValue(char const_) in gv8bind.cpp.o
..... (many such v8 symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[5]: *_* [libcpgf.dylib] Error 1
make[4]: *** [CMakeFiles/lib.dir/all] Error 2
make[3]: *** [CMakeFiles/lib.dir/rule] Error 2
make[2]: *** [lib] Error 2
make[1]: *** [/Users/rharchandani/Documents/qtjs-generator/src/..//lib/cpgf-build/build/libcpgf.so] Error 2
make: *** [sub-src-core-make_first-ordered] Error 2

I am not sure why this is happening. should it not use the v8 library which is part of node that comes with this package?

Thanks,
Rohit

Hi Rohit,

Thanks for your issue report!

I'll try to boot a mac and fix the issue during the weekend (or in a near future :)) .

Regards
Sarunas

I had only tested compiling cpgf core library on Mac, without any third party libraries :(

Yeah it's related to the compiler / linking options for libstd and v8 (as
currently the build scripts assume Linux paths) - I almost have it working
but will only be able to continue in the evening/tomorrow.

Thats great..Thanks Sarunas :)

I've fixed the linking errors in #17 PR, however it seems that Cocoa platform integration does not support using the custom event dispatcher.

until this is solved, removing

QCoreApplication::setEventDispatcher(ev_dispatcher);

line from main.cpp will use cocoa Ev dispatcher and allow some usage of the widget examples.

I also noticed that the qml example breaks on mac and will have a look at it once I know how to deal with the cocoa/libuv dispatcher incompatibilities.

Hi @harchu,

Any chance you could try build-on-mac branch? (you'll need to update the submodules there as well and delete the previously build temp files).

Also, its updated to Qt 5.3.1.

P.S.
The cocoa events still seem to be slowish to react so some work still needs to be done for the event loop unification on mac, but I get it to build now and run all the provided examples :)

Regards,
Sarunas

Hi @svalaskevicius,

It builds now!! Thanks for your help and the quick response. Will play around with it.

Regards,
Rohit

Hi @svalaskevicius,

Seems like the qt classes do not have the events functions? Why is that? For example, QWidget does not seem to have 'paintEvent'. Is this a known issue?

Thanks,
Rohit

hey @harchu, if you need to extend classes to override methods, you'll need to use their wrappers as they have the placeholder methods for the virtual functions.

see e.g. https://github.com/svalaskevicius/qtjs-generator/blob/master/examples/widgets.js#L6

where I have defined the qt.extend function as this: https://github.com/svalaskevicius/qtjs-generator/blob/master/examples/qt.js#L5

closing the issue as I've just merged the PR that fixes it :)