Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link error use .a files on ubuntu #23

Closed
zhwaaaaaa opened this issue Apr 25, 2020 · 2 comments
Closed

link error use .a files on ubuntu #23

zhwaaaaaa opened this issue Apr 25, 2020 · 2 comments
Labels
question Further information is requested

Comments

@zhwaaaaaa
Copy link

I executed cmake && make and got some *.a files, and copied these files to /usr/local/v8/lib.
I use the *.a file to build a executable file.
g++ main.cpp -I/usr/local/v8/include -L/usr/local/v8/lib -lv8_base_without_compiler -lv8_compiler -lv8_snapshot -lv8_inspector -lv8_libplatform
got so much error message.
......
/usr/bin/ld: /usr/local/v8/lib/libv8_libplatform.a(trace-object.cc.o): in function v8::platform::tracing::TraceObject::Initialize(char, unsigned char const*, char const*, char const*, unsigned long, unsigned long, int, char const**, unsigned char const*, unsigned long const*, std::unique_ptr<v8::ConvertableToTraceFormat, std::default_delete<v8::ConvertableToTraceFormat> >*, unsigned int, long, long)': trace-object.cc:(.text+0x73): undefined reference to v8::base::OS::GetCurrentProcessId()'
/usr/bin/ld: trace-object.cc:(.text+0x83): undefined reference to `v8::base::OS::GetCurrentThreadId()'

@bnoordhuis
Copy link
Owner

You're missing -lv8_libbase. It should come last because the other libraries depend on it.

Linking should get a whole lot easier once #14 is implemented.

@bnoordhuis bnoordhuis added the question Further information is requested label Apr 25, 2020
@zhwaaaaaa
Copy link
Author

I resolved it with -lv8_base_without_compiler -lv8_compiler -lv8_snapshot -lv8_inspector -lv8_libplatform -lv8_libbase -lv8_base_without_compiler -lpthread .
and I combined them to monolith with command ar x *.a && ar crs libv8.a *.o. it works.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants