简体   繁体   English

v8你好世界示例链接错误

[英]v8 hello world example link error

I read V8 hello world example, and follow the steps in the document to build v8 successfully. 我阅读了V8 hello world示例,并按照文档中的步骤成功构建了v8。

But when I compile the example code, link error occured. 但是当我编译示例代码时,发生了链接错误。 Here comes my computer detail and error prompts. 这是我的计算机详细信息和错误提示。

  1. OS Ubuntu 13.10 amd64 操作系统Ubuntu 13.10 amd64
  2. GCC (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 GCC(Ubuntu / Linaro 4.8.1-10ubuntu9)4.8.1
  3. Compile command: 编译命令:
g++ -Iinclude hello_world.cc -o hello_world -Wl,--start-group out/native/obj.target/{tools/gyp/libv8_{base.x64,snapshot},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt

Error prompts 错误提示

 /usr/bin/ld: /home/leon/Documents/v8/v8/out/native/obj.target/v8_base.x64/src/platform/mutex.o: undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status 

The error suggests that you need to add the pthread library to your link command. 该错误表明您需要将pthread库添加到链接命令中。 Just append -lpthread . 只需追加-lpthread

(It's a bit odd that it identifies exactly which library you need, then tells you it refuses to use it because you didn't list it on the command-line...) (奇怪的是,它准确地标识了您需要的库,然后告诉您它拒绝使用它,因为您没有在命令行上列出它。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM