facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.19k stars 3k forks source link

HHVM build/link error on Ubuntu 14.04 #5079

Closed uttampawar closed 9 years ago

uttampawar commented 9 years ago

Hi All, My hhvm build is failing with link error. I followed the instructions given at https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-Ubuntu-14.04 to build HHVM.

HHVM source cloned today.

-- hhvm build steps -- $ ./configure -DCMAKE_BUILD_TYPE=Release $ make -j 2 And it fails with following error, ... [100%] Generating systemlib.php [100%] Built target systemlib Linking CXX executable hhvm ../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_niloadextension(HPHP::ObjectData, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension' ../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_niloadextension(HPHP::ObjectData, HPHP::String const&): error: undefined reference to 'sqlite3_load_extension' ../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_niloadextension(HPHP::ObjectData, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension' ../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_niloadextension(HPHP::ObjectData, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension' collect2: error: ld returned 1 exit status make[2]: * [hphp/hhvm/hhvm] Error 1 make[1]: * [hphp/hhvm/CMakeFiles/hhvm.dir/all] Error 2 make: *\ [all] Error 2

-- libsqlite3-dev package -- $ apt-cache show libsqlite3-dev Package: libsqlite3-dev Priority: optional Section: libdevel Installed-Size: 1456 Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Original-Maintainer: Laszlo Boszormenyi (GCS) gcs@debian.org Architecture: amd64 Source: sqlite3 Version: 3.8.2-1ubuntu2 Depends: libsqlite3-0 (= 3.8.2-1ubuntu2), libc6-dev

-- GCC - gcc version 4.8.2

Any help is appreciated. Thanks.

--Uttam

jwatzman commented 9 years ago

Can you post the entire output from the configure step, as well as the last 50 or so lines of VERBOSE=1 make? (You can pastebin the latter)

uttampawar commented 9 years ago

Configure out put,

-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   program_options
--   filesystem
-- System PCRE does not have JIT enabled - will use hhvm-third-party/pcre
-- Found libevent: /usr/lib/x86_64-linux-gnu/libevent.so
-- Could NOT find LibUODBC (missing:  LIBODBC_LIBRARIES LIBODBC_INCLUDE_DIRS) 
-- Found libsqlite3: /usr/local/lib/libsqlite3.so
-- Could NOT find DOUBLE_CONVERSION (missing:  DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR) 
-- Using third-party bundled double-conversion
-- Could NOT find LZ4 (missing:  LZ4_LIBRARY LZ4_INCLUDE_DIR) 
-- Using third-party bundled LZ4
-- Could NOT find FastLZ (missing:  FASTLZ_LIBRARY FASTLZ_INCLUDE_DIR) 
-- Using third-party bundled fastlz
-- Could NOT find LIBZIP (missing:  LIBZIP_LIBRARY LIBZIP_INCLUDE_DIR_ZIP LIBZIP_INCLUDE_DIR_ZIPCONF) 
-- Using third-party bundled libzip
-- Found ICU header files in /usr/include/x86_64-linux-gnu
-- Found ICU libraries: /usr/lib/x86_64-linux-gnu/libicuuc.so
-- Found jemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so
-- Found Intel TBB
-- Found mcrypt: /usr/lib/libmcrypt.so
-- Looking for dwarf_producer_init
-- Looking for dwarf_producer_init - found
-- Performing Test DW_CONST
-- Performing Test DW_CONST - Failed
-- Looking for dwarf_producer_init_c
-- Looking for dwarf_producer_init_c - found
-- Performing Test DW_CONST
-- Performing Test DW_CONST - Failed
-- libdwarf uses char* type
-- libdwarf has dwarf_producer_init_c
-- Did not find system RE2
-- Building RE2 from third-party
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   program_options
--   filesystem
--   regex
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   system
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   system
-- Found libevent: /usr/lib/x86_64-linux-gnu/libevent.so
-- Found libevent 2.0.9+
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   context
--   regex
--   system
--   filesystem
-- Found Readline: /usr/include
-- 
-- 
-- PCRE configuration summary:
-- 
--   C compiler ...................... : /usr/bin/cc
--   C++ compiler .................... : /usr/bin/c++
--   C compiler flags ................ :   -ftrack-macro-expansion=0 -fno-builtin-memcmp -w -O3 -DNDEBUG
--   C++ compiler flags .............. :  -Wall -std=gnu++11 -ffunction-sections -fno-gcse -fno-omit-frame-pointer -ftemplate-depth-180 -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-unused-local-typedefs -fno-canonical-system-headers -Wno-deprecated-declarations -Wno-unused-function  -ftrack-macro-expansion=0 -fno-builtin-memcmp -mcrc32 -O3 -DNDEBUG -fno-gcse -momit-leaf-frame-pointer --param max-inline-insns-auto=100 --param early-inlining-insns=200 --param max-early-inliner-iterations=50
-- 
--   Build 8 bit PCRE library ........ : ON
--   Build 16 bit PCRE library ....... : OFF
--   Build 32 bit PCRE library ....... : OFF
--   Build C++ library ............... : ON
--   Enable JIT compiling support .... : ON
--   Enable UTF support .............. : ON
--   Unicode properties .............. : ON
--   Newline char/sequence ........... : LF
--   \R matches only ANYCRLF ......... : OFF
--   EBCDIC coding ................... : OFF
--   EBCDIC coding with NL=0x25 ...... : OFF
--   Rebuild char tables ............. : OFF
--   No stack recursion .............. : OFF
--   POSIX mem threshold ............. : 10
--   Internal link size .............. : 2
--   Match limit ..................... : 10000000
--   Match limit recursion ........... : MATCH_LIMIT
--   Build shared libs ............... : OFF
--   Build static libs ............... : ON
--   Build pcregrep .................. : ON
--   Enable JIT in pcregrep .......... : ON
--   Buffer size for pcregrep ........ : 20480
--   Build tests (implies pcretest  .. : ON
--                and pcregrep)
--   Link pcregrep with libz ......... : ON
--   Link pcregrep with libbz2 ....... : ON
--   Link pcretest with libeditline .. : OFF
--   Link pcretest with libreadline .. : ON
--   Support Valgrind .................: OFF
--   Support coverage .................: OFF
-- 
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   program_options
--   filesystem
-- System PCRE does not have JIT enabled - will use hhvm-third-party/pcre
-- Found libevent: /usr/lib/x86_64-linux-gnu/libevent.so
-- Could NOT find LibUODBC (missing:  LIBODBC_LIBRARIES LIBODBC_INCLUDE_DIRS) 
-- Found libsqlite3: /usr/local/lib/libsqlite3.so
-- Could NOT find DOUBLE_CONVERSION (missing:  DOUBLE_CONVERSION_LIBRARY DOUBLE_CONVERSION_INCLUDE_DIR) 
-- Using third-party bundled double-conversion
-- Could NOT find LZ4 (missing:  LZ4_LIBRARY LZ4_INCLUDE_DIR) 
-- Using third-party bundled LZ4
-- Could NOT find FastLZ (missing:  FASTLZ_LIBRARY FASTLZ_INCLUDE_DIR) 
-- Using third-party bundled fastlz
-- Could NOT find LIBZIP (missing:  LIBZIP_LIBRARY LIBZIP_INCLUDE_DIR_ZIP LIBZIP_INCLUDE_DIR_ZIPCONF) 
-- Using third-party bundled libzip
-- Found ICU header files in /usr/include/x86_64-linux-gnu
-- Found ICU libraries: /usr/lib/x86_64-linux-gnu/libicuuc.so
-- Found jemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so
-- Found Intel TBB
-- Found mcrypt: /usr/lib/libmcrypt.so
-- Looking for dwarf_producer_init
-- Looking for dwarf_producer_init - found
-- Performing Test DW_CONST
-- Performing Test DW_CONST - Failed
-- Looking for dwarf_producer_init_c
-- Looking for dwarf_producer_init_c - found
-- Performing Test DW_CONST
-- Performing Test DW_CONST - Failed
-- libdwarf uses char* type
-- libdwarf has dwarf_producer_init_c
-- Found ocamlc: /usr/bin/ocamlc
-- Found ocamlc.opt: /usr/bin/ocamlc.opt
-- Building async MySQL extension
-- Building mcrouter extension
-- Using built-in JSON parser
-- GNU FriBidi not found
-- Found gold: /usr/bin/gold
-- Configuring done
-- Generating done
-- Build files have been written to: /home/upawar/hhvm/hhvm

Here is a pastebin link for the make output. http://pastebin.com/BFiyUhmU

jwatzman commented 9 years ago
/usr/bin/c++    -Wall -std=gnu++11 -ffunction-sections -fno-gcse -fno-omit-frame-pointer -ftemplate-depth-180 -Woverloaded-virtual -Wno-deprecated -Wno-strict-aliasing -Wno-write-strings -Wno-invalid-offsetof -fno-operator-names -Wno-error=array-bounds -Wno-error=switch -Werror=format-security -Wno-unused-result -Wno-sign-compare -Wno-attributes -Wno-maybe-uninitialized -Wno-unused-local-typedefs -fno-canonical-system-headers -Wno-deprecated-declarations -Wno-unused-function  -ftrack-macro-expansion=0 -fno-builtin-memcmp -mcrc32 -O3 -DNDEBUG -fno-gcse -momit-leaf-frame-pointer --param max-inline-insns-auto=100 --param early-inlining-insns=200 --param max-early-inliner-iterations=50    CMakeFiles/hhvm.dir/global-variables.cpp.o CMakeFiles/hhvm.dir/main.cpp.o CMakeFiles/hhvm.dir/process-init.cpp.o  -o hhvm -rdynamic -Wl,-uregister_libevent_server,-uregister_fastcgi_server -Wl,--whole-archive ../runtime/libhphp_runtime.a ../runtime/ext/libhphp_runtime_ext.a ../runtime/ext_zend_compat/libhphp_ext_zend_compat.a -Wl,--no-whole-archive ../compiler/libhphp_analysis.a ../runtime/ext_hhvm/libext_hhvm.a ../system/libhphp_system.a ../parser/libhphp_parser.a ../zend/libhphp_zend.a ../util/libhphp_util.a ../hhbbc/libhphp_hhbbc.a ../vixl/libvixl.a ../neo/libneo.a ../../third-party/thrift/libhphp_thrift.a ../../third-party/proxygen/libhphp_proxygen.a -fuse-ld=gold -Wl,--section-ordering-file,/home/upawar/hhvm/hhvm/hphp/hhvm/../tools/oss_hot_section_ordering -lyaml ../runtime/ext/libhphp_runtime_ext.a ../../third-party/squangle/libsquangle.a ../../third-party/re2/libre2.a ../../third-party/double-conversion/libdouble-conversion.a ../../third-party/lz4/liblz4.a ../../third-party/libzip/libzip.a ../../third-party/pcre/libpcre.a ../../third-party/fastlz/libfastlz.a ../../third-party/timelib/libtimelib.a ../../third-party/mcrouter/libmcrouter.a ../../third-party/folly/libfolly.a -lboost_context -lboost_regex ../../third-party/libafdt/libafdt.a ../../third-party/libmbfl/mbfl/libmbfl.a -Wl,--wrap=pthread_create -Wl,--wrap=pthread_exit -Wl,--wrap=pthread_join -lMagickWand -lMagickCore -lgmp -ljpeg -lpng -lvpx -lfreetype -lc-client -ldl -licudata -licui18n -licuuc -lcurl -lcap -lresolv -ldl -licudata -licui18n -licuuc -lcurl -lcap -lresolv -ljemalloc -lboost_program_options -lboost_filesystem ../../third-party/webscalesqlclient/src//libmysql/libwebscalesqlclient_r.a ../../third-party/webscalesqlclient/src//extra/yassl/libyassl.a ../../third-party/webscalesqlclient/src//extra/yassl/taocrypt/libtaocrypt.a -levent -Wl,-Bstatic -lbfd -liberty -Wl,-Bdynamic -ltbb -lssl -lcrypto -lz -lbz2 -lxml2 -lxslt -lexslt -lexpat -lonig -lmcrypt -lldap -llber -lmemcached -lcrypt -lrt /usr/local/lib/libsqlite3.so -ledit -lpam -Wl,-Bstatic -ldwarf -Wl,-Bdynamic -lelf ../../third-party/thrift/libhphp_thrift.a -lboost_thread -lboost_system -lglog -lpthread -Wl,-rpath,/usr/local/lib
../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_ni_loadextension(HPHP::ObjectData*, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension'
../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_ni_loadextension(HPHP::ObjectData*, HPHP::String const&): error: undefined reference to 'sqlite3_load_extension'
../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_ni_loadextension(HPHP::ObjectData*, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension'
../runtime/ext/libhphp_runtime_ext.a(ext_sqlite3.cpp.o):ext_sqlite3.cpp:function HPHP::c_SQLite3_ni_loadextension(HPHP::ObjectData*, HPHP::String const&): error: undefined reference to 'sqlite3_enable_load_extension'
collect2: error: ld returned 1 exit status

Hm, I wonder why it's not finding those symbols in the sqlite3 library? (It's there in the link line.) Maybe it's a version mismatch?

@uttampawar can you tell me what ls -R /usr/local/include produces? Do you know where /usr/local/lib/libsqlite3.so came from, do you have some manually installed version of sqlite, that might be different from the version from apt-get? I'm suspecting your library and headers are mismatched.

uttampawar commented 9 years ago

Yes. There were 2 version of sqlite3 were installed. Once I remove one of them using only v3.8.2 , the link error went away. Thanks for all the help in tracking this problem.