Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:48 Go to next message
Florian Jean is currently offline Florian JeanFriend
Messages: 3
Registered: March 2018
Junior Member
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] Wed, 28 March 2018 02:16 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
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 06:24]

Report message to a moderator

Re: Can't import google v8 library [message #1784447 is a reply to message #1784439] Wed, 28 March 2018 06:40 Go to previous messageGo to next message
Florian Jean is currently offline Florian JeanFriend
Messages: 3
Registered: March 2018
Junior Member
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 06:41]

Report message to a moderator

Re: Can't import google v8 library [message #1784452 is a reply to message #1784439] Wed, 28 March 2018 07:29 Go to previous message
Florian Jean is currently offline Florian JeanFriend
Messages: 3
Registered: March 2018
Junior Member
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: Fri Apr 19 08:01:26 GMT 2024

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

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

Back to the top