Qmake Library V8 'undefined reference'

closed account (oGhfSL3A)
Hello.

I am trying to link a library(Google V8) using Qmake and doing something wrong.

Following the https://developers.google.com/v8/get_started guide, everything went well, and compiling with g++ works(my path to v8 and headers is slightly different):

1
2
3
g++ -I. main.cpp -o test -Wl,--start-group v8/x64.release/obj.target/{tools/gyp/libv8_{base,
libbase,external_snapshot,libplatform},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group 
-lrt -ldl -pthread -std=c++0x


But I am trying to compile in QtCreator with Qmake. My .pro looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
TEMPLATE = app
CONFIG += console c++14 thread
CONFIG -= app_bundle qt

LIBS += -L$$PWD/v8/x64.release/obj.target/tools/gyp
                -lv8_basei
                -lv8_libbase
                -lv8_external_snapshot
                -lv8_libplatform
        -L$$PWD/v8/x64.release/obj.target/third_party/icu
                -licuuc
                -licui18n
                -licudata
        -lrt
        -ldl

SOURCES += main.cpp


but it won't compile, with all the errors like: "error: undefined reference to `v8::V8::InitializeICU(char const*)'" ..and similar. like it cant see the libraries. My QtCreator is using GCC so I don't know if that has anything to do with it.

Thanks for reading! Hopefully someone can help. (:
Last edited on
$$PWD will be wrong if you have "shadow build" enabled (check box under projects).
Last edited on
closed account (oGhfSL3A)
I did have 'shadow build' enabled, which I have now disabled, but I am still getting the same error.

I also tried it with absolute paths with no luck.
Last edited on
I have never used the options --start-group --end-group, but perhaps you need to pass them to the linker.
https://sourceware.org/binutils/docs/ld/Options.html#index-groups-of-archives-136

Maybe something like this:
1
2
3
4
5
6
7
8
9
. . .
LIBS += -Wl,--start-group \
             -L path/to/libs \
                 -lv8_base \
                 . . .
                 . . .
             -ldl \
        -Wl,--end-group
. . .


HTH
closed account (oGhfSL3A)
That did it! Thanks! :D
It was also because I didn't have the backslashes.
Topic archived. No new replies allowed.