ubuntu64位系统编译时头文件找不到的问题

今天编译webrtc时出现以下错误:

ninja -C out/Debug All
ninja: Entering directory `out/Debug'
[1/6] CXX obj/talk/app/webrtc/java/jni...peerconnection_so.peerconnection_jni.o
FAILED: g++ -MMD -MF obj/talk/app/webrtc/java/jni/libjingle_peerconnection_so.peerconnection_jni.o.d -DANGLE_DX11 -DEXPAT_RELATIVE_PATH -DFEATURE_ENABLE_VOICEMAIL -DGTEST_RELATIVE_PATH -DJSONCPP_RELATIVE_PATH -DLOGGING=1 -DSRTP_RELATIVE_PATH -DFEATURE_ENABLE_SSL -DFEATURE_ENABLE_PSTN -DHAVE_SRTP -DHAVE_WEBRTC_VIDEO -DHAVE_WEBRTC_VOICE -DUSE_WEBRTC_DEV_BRANCH -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_NSS=1 -DUSE_X11=1 -DENABLE_ONE_CLICK_SIGNIN -DGTK_DISABLE_SINGLE_INCLUDES=1 -DUSE_XI2_MT=2 -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_INPUT_SPEECH -DENABLE_NOTIFICATIONS -DENABLE_EGLIMAGE=1 -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_BACKGROUND=1 -DENABLE_AUTOMATION=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_FULL_PRINTING=1 -DENABLE_PRINTING=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_MANAGED_USERS=1 -DENABLE_MDNS=1 -DLIBPEERCONNECTION_LIB=1 -DLINUX -DHASH_NAMESPACE=__gnu_cxx -DPOSIX -DDISABLE_DYNAMIC_CAST -DHAVE_OPENSSL_SSL_H=1 -D_REENTRANT -DHAVE_GTK -DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -I../.. -I../../third_party -I../../third_party/webrtc -I../../webrtc -I/data/jdk1.7.0_45/include -I/data/jdk1.7.0_45/include/linux -I../../third_party/icu/source/common -fstack-protector --param=ssp-buffer-size=4 -pthread -fno-exceptions -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-unused-local-typedefs -Wno-format -Wno-unused-result -O0 -g -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -Wno-deprecated  -c ../../talk/app/webrtc/java/jni/peerconnection_jni.cc -o obj/talk/app/webrtc/java/jni/libjingle_peerconnection_so.peerconnection_jni.o
../../talk/app/webrtc/java/jni/peerconnection_jni.cc: In function ‘std::string {anonymous}::GetThreadId()’:
../../talk/app/webrtc/java/jni/peerconnection_jni.cc:149:63: error: ‘syscall’ was not declared in this scope
   CHECK(snprintf(buf, sizeof(buf), "%llu", syscall(__NR_gettid)) <= sizeof(buf),
                                                               ^
../../talk/app/webrtc/java/jni/peerconnection_jni.cc:113:7: note: in definition of macro ‘CHECK’
   if (x) {} else {                                                             \
       ^
ninja: build stopped: subcommand failed.

说找不到linux系统头文件syscall.h文件。

搜索syscall.h头文件位于哪个包中:

dpkg-query -S syscall.h
发现已经安装在/usr/include/x86_64-linux-gnu/sys中。这是由于ubuntu为了安装不同架构的系统而分出来的。

 

查看g++联接:

k@k-C410:/data/google/trunk$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8)

解决方法:

export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu/
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu/

加入下面下行:

#define _GNU_SOURCE         /* See feature_test_macros(7) */
#include
#include    /* For SYS_xxx definitions */


ubuntu中syscall定义是放在头文件unistd.h中的。


在网上发现与此问题找不到库的类似的问题:http://zhaohongjian000.is-programmer.com/posts/32631.html

你可能感兴趣的:(Linux,ubuntu)