Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Can't import google v8 library(google v8 library)
Can't import google v8 library [message #1784385] Tue, 27 March 2018 08:48 Go to next message
Eclipse UserFriend
Hello,

I'm trying to use the google v8 library.
So far, I compiled it as a static library and I m able to compile the hello-world example.

I'm able to compile the hello-world example from another directory with the command in the terminal :
Quote:
g++ -I/home/florian/workspace/lib/v8/v8/include /home/florian/workspace/test_v8/test_v8.cc -o test_v8compiled2 -Wl,--start-group /home/florian/workspace/lib/v8/v8/out.gn/x64.release/obj/{libv8_{base,libbase,external_snapshot,libplatform,libsampler},third_party/icu/libicu{uc,i18n},src/inspector/libinspector}.a -Wl,--end-group -lrt -ldl -pthread -std=c++0x


However, I can't get to compile the Hello-world example using eclipse IDE

All Options from cross g++ compiler :
Quote:
-std=c++0x -I/home/florian/workspace/lib/v8/v8/include -O0 -g3 -Wall -c -fmessage-length=0 -v


All Options from cross g++ linker :
Quote:
-L/home/florian/workspace/lib/v8/v8/out.gn/x64.release/obj -L/home/florian/workspace/lib/v8/v8/out.gn/x64.release/obj/third_party/icu -L/home/florian/workspace/lib/v8/v8/out.gn/x64.release/obj/src/inspector


I also put the libraries in the Libraries option (-l)
v8_base
v8_libbase
.. So on

I get a lot of "undefined reference " error while compiling. What am I missing ??
Why doesn't the -l appear in the All Options from cross g++ linker ?
Thanks


Re: Can't import google v8 library [message #1784439 is a reply to message #1784385] Tue, 27 March 2018 22:16 Go to previous messageGo to next message
Eclipse UserFriend
You mean you can't link it.
It probably compiled OK.


The problem is that the libraries must be presented as a group to the linker.
This tells the linker to scan them repeatedly to resolve circular references.
They need to appear between --start-group and --end-group.
In the g++ command line these are preceded by -Wl, which means "pass to linker".
(Note: the comma is important)

ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html

It's going to be difficult to get the CDT tool chain to place these properly.
You may be able to get it done using the linker Miscellaneous settings.
However, it will likely be easier to create your own makefile.





[Updated on: Wed, 28 March 2018 02:24] by Moderator

Re: Can't import google v8 library [message #1784447 is a reply to message #1784439] Wed, 28 March 2018 02:40 Go to previous messageGo to next message
Eclipse UserFriend
Yeah actually I figured it out yesterday, it was indeed a circular reference issue.

I gave the library path with the -L option and I appended all the library from v8 with the -l option in between the start-group and stop-group in Miscellaneous.

Now it compiles fine

Thank you for your help

[Updated on: Wed, 28 March 2018 02:41] by Moderator

Re: Can't import google v8 library [message #1784452 is a reply to message #1784439] Wed, 28 March 2018 03:29 Go to previous message
Eclipse UserFriend
IMPORTANT :

I also had to change the linker command to

${COMMAND} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}
instead of
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
Previous Topic:[DSF-GDB] SessionType, which to use or what to do
Next Topic:[DSF-GDB] Extend FinalLaunchSequence Redo stepInitializeFinalLaunchSequence
Goto Forum:
  


Current Time: Wed Jul 23 06:32:13 EDT 2025

Powered by FUDForum. Page generated in 0.04582 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top