vitalif / grive2

Google Drive client with support for new Drive REST API and partial sync
http://yourcmc.ru/wiki/Grive2
GNU General Public License v2.0
1.52k stars 140 forks source link

CentOS 6 compilation fail (yajl and boost-date-time) #34

Open do11 opened 9 years ago

do11 commented 9 years ago

I installed all requirements and just did git clone.

root@/home/cloud/grive2/build# cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found libgcrypt: -lgcrypt -ldl -lgpg-error
-- Found CURL: /usr/lib64/libcurl.so (found version "7.19.7")
-- Found EXPAT: /usr/lib64/libexpat.so (found version "2.0.1")
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   unit_test_framework
--   regex
--   system
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.23")
-- checking for module 'yajl'
--   package 'yajl' not found
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:279 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
  libgrive/CMakeLists.txt:15 (pkg_check_modules)

CMake Error at /usr/lib64/boost/Boost.cmake:536 (message):
  The imported target "boost_date_time-static" references the file

     "/usr/lib64/lib64/libboost_date_time.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib64/boost/Boost.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib64/boost/BoostConfig.cmake:28 (include)
  /usr/share/cmake/Modules/FindBoost.cmake:177 (find_package)
  grive/CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/cloud/grive2/build/CMakeFiles/CMakeOutput.log".

But yajl package is here, and boost_date_time too. (There is no static libboost_date_time.a in Centos, though.)

root@/home/cloud/grive2/build# rpm -qa --last
yajl-devel-1.0.7-3.el6.x86_64                 Sun Oct 11 17:51:43 2015
cmake-2.8.12.2-4.el6.x86_64                   Sun Oct 11 17:51:21 2015
libarchive-2.8.3-4.el6_2.x86_64               Sun Oct 11 17:51:19 2015
boost-devel-1.41.0-27.el6.x86_64              Sun Oct 11 17:50:42 2015
boost-math-1.41.0-27.el6.x86_64               Sun Oct 11 17:50:38 2015
boost-1.41.0-27.el6.x86_64                    Sun Oct 11 17:50:38 2015
boost-signals-1.41.0-27.el6.x86_64            Sun Oct 11 17:50:37 2015
boost-python-1.41.0-27.el6.x86_64             Sun Oct 11 17:50:37 2015
boost-serialization-1.41.0-27.el6.x86_64      Sun Oct 11 17:50:36 2015
boost-iostreams-1.41.0-27.el6.x86_64          Sun Oct 11 17:50:35 2015
boost-test-1.41.0-27.el6.x86_64               Sun Oct 11 17:50:34 2015
boost-program-options-1.41.0-27.el6.x86_64    Sun Oct 11 17:50:34 2015
boost-wave-1.41.0-27.el6.x86_64               Sun Oct 11 17:50:33 2015
boost-graph-1.41.0-27.el6.x86_64              Sun Oct 11 17:50:33 2015
boost-regex-1.41.0-27.el6.x86_64              Sun Oct 11 17:50:32 2015
boost-date-time-1.41.0-27.el6.x86_64          Sun Oct 11 17:50:32 2015
boost-thread-1.41.0-27.el6.x86_64             Sun Oct 11 17:50:31 2015
boost-filesystem-1.41.0-27.el6.x86_64         Sun Oct 11 17:50:30 2015
boost-system-1.41.0-27.el6.x86_64             Sun Oct 11 17:50:29 2015
...
yajl-1.0.7-3.el6.x86_64                       Tue Sep  3 05:07:43 2013
vitalif commented 9 years ago

You need yajl 2.x, not 1.x. I've never tried to build grive with older yajl. About the boost "/usr/lib64/lib64/libboost_date_time.a" error... I suspect it could be a bug of centos package, because grive just uses system cmake boost module.

do11 commented 9 years ago

Thanks, I installed yajl from the git repo.

# git clone git://github.com/lloyd/yajl
# cd  yajl/
# ./configure
# make
# make install
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libyajl.so.2.1.1
-- Installing: /usr/local/lib/libyajl.so.2
-- Installing: /usr/local/lib/libyajl.so
-- Installing: /usr/local/lib/libyajl_s.a
-- Installing: /usr/local/include/yajl/yajl_parse.h
-- Installing: /usr/local/include/yajl/yajl_gen.h
-- Installing: /usr/local/include/yajl/yajl_common.h
-- Installing: /usr/local/include/yajl/yajl_tree.h
-- Installing: /usr/local/include/yajl/yajl_version.h
-- Installing: /usr/local/share/pkgconfig/yajl.pc
-- Installing: /usr/local/bin/json_reformat
-- Removed runtime path from "/usr/local/bin/json_reformat"
-- Installing: /usr/local/bin/json_verify
-- Removed runtime path from "/usr/local/bin/json_verify"

This was not enough, though, becasue cmake still doesn't see yajl, probably because pkg-config doesn't see it, so I forced to trick it:

# yum erase yajl-devel
# ln -s /usr/local/share/pkgconfig/yajl.pc /usr/share/pkgconfig/yajl.pc

Do you think it possible to tell cmake to find yajl in /usr/local/ ?

Anyway, now cmake sees yajl, but there is still boost error:

root@/home/cloud/grive2/build# cmake ..
-- Found libgcrypt: -lgcrypt -ldl -lgpg-error
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   unit_test_framework
--   regex
--   system
-- checking for module 'yajl'
--   found yajl, version 2.1.1
CMake Error at /usr/lib64/boost/Boost.cmake:536 (message):
  The imported target "boost_date_time-static" references the file

     "/usr/lib64/lib64/libboost_date_time.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib64/boost/Boost.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib64/boost/BoostConfig.cmake:28 (include)
  /usr/share/cmake/Modules/FindBoost.cmake:177 (find_package)
  grive/CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/cloud/grive2/build/CMakeFiles/CMakeOutput.log".

...I wonder why it tries to find libboost_date_time.a, because, there is only libboost_date_time.so

root@/home/cloud/grive2/build# rpm -ql boost-date-time
/usr/lib64/libboost_date_time-mt.so.5
/usr/lib64/libboost_date_time.so.5
/usr/share/doc/boost-date-time-1.41.0
/usr/share/doc/boost-date-time-1.41.0/LICENSE_1_0.txt
do11 commented 9 years ago

I googled how to workaround it, but still there's another problem:

root@/home/cloud/grive2/build# cmake -DBoost_NO_BOOST_CMAKE=BOOL:ON ..
-- Found libgcrypt: -lgcrypt -ldl -lgpg-error
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   unit_test_framework
--   regex
--   system
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cloud/grive2/build
root@/home/cloud/grive2/build# make
Scanning dependencies of target grive
[  2%] Building CXX object libgrive/CMakeFiles/grive.dir/src/base/Entry.cc.o
[  4%] Building CXX object libgrive/CMakeFiles/grive.dir/src/base/ResourceTree.cc.o
[  6%] Building CXX object libgrive/CMakeFiles/grive.dir/src/base/State.cc.o
/home/cloud/grive2/libgrive/src/base/State.cc: In member function 'void gr::State::FromLocal(const boost::filesystem::path&, gr::Resource*)':
/home/cloud/grive2/libgrive/src/base/State.cc:81: error: 'struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >' has no member named 'string'
make[2]: *** [libgrive/CMakeFiles/grive.dir/src/base/State.cc.o] Error 1
make[1]: *** [libgrive/CMakeFiles/grive.dir/all] Error 2
make: *** [all] Error 2

What this could be? Too old boost?

vitalif commented 9 years ago

set PKG_CONFIG_PATH=/usr/lib:/usr/local/lib to make pkg-config look in both locations (although I think it should be lib64 on centos)

vitalif commented 9 years ago

yes, it may be the problem of old boost... it seems i->path().filename() is just std::string there. you can try to workaround the issue by changing i->path().filename().string() to i->path().filename()...

do11 commented 9 years ago

Thanks again, its worked!

root@/home/cloud/grive2/build# export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:/usr/local/share/pkgconfig
root@/home/cloud/grive2/build# rm /usr/share/pkgconfig/yajl.pc # removed my hack
root@/home/cloud/grive2/build# cmake ..
-- Found libgcrypt: -lgcrypt -ldl -lgpg-error
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   unit_test_framework
--   regex
--   system
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cloud/grive2/build

Boost workaround worked too:

root@/home/cloud/grive2/build# vim /home/cloud/grive2/libgrive/src/base/State.cc
...
[  6%] Building CXX object libgrive/CMakeFiles/grive.dir/src/base/Resource.cc.o
/home/cloud/grive2/libgrive/src/base/Resource.cc: In member function 'void gr::Resource::FromLocal(const gr::DateTime&)':
/home/cloud/grive2/libgrive/src/base/Resource.cc:252: error: 'struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >' has no member named 'string'
make[2]: *** [libgrive/CMakeFiles/grive.dir/src/base/Resource.cc.o] Error 1
make[1]: *** [libgrive/CMakeFiles/grive.dir/all] Error 2
make: *** [all] Error 2
...
root@/home/cloud/grive2/build# vim /home/cloud/grive2/libgrive/src/base/Resource.cc

Second fix is same, removing string(). After that make finished w/o errors. But,

root@/home/cloud/grive2/build# grive
grive: error while loading shared libraries: libyajl.so.2: cannot open shared object file: No such file or directory
root@/home/cloud/grive2/build# ldd /usr/local/bin/grive
        linux-vdso.so.1 =>  (0x00007fff4dbff000)
        libboost_program_options-mt.so.5 => /usr/lib64/libboost_program_options-mt.so.5 (0x00007f2b2bb1c000)
        libyajl.so.2 => not found
        libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007f2b2b8c7000)

Fix:

root@/home/cloud/grive2/build# echo /usr/local/lib > /etc/ld.so.conf.d/usr-local-lib.conf
root@/home/cloud/grive2/build# ldconfig
root@/home/cloud/grive2/build# grive
Please run grive with the "-a" option if this is the first time you're accessing your Google Drive!

Big thanks for the help!

ps. Wow that wasn't easy install. ;-) Maybe you could make troubleshooting page for standard errors.

vitalif commented 9 years ago

Oh... ld.so.conf modification was probably required because yajl should be also installed into /usr/local/lib64 under centos... because it's very strange that /usr/local was not present in the ld config... Other fixes are probably also centos6-related, so centos6 rpm spec would be the proper place to contain all workarounds. There is some older spec in package/fedora16/grive.spec, maybe you could modify it to make a centos6 package and submit a pullrequest? :)

vitalif commented 9 years ago

(I personally have no installed centos6 at the moment... in fact no rpm-based distros at all :))

do11 commented 9 years ago

Nor centos6, nor centos7 have /usr/local/lib into ld.so.conf* by default. And yajl is installed there because I did normal make install for yajl's git cloned src, for it not to conflict with system wide centos6's, older, yajl-1.0.7, which is used by libvirt (which I use). I think proper way is to create package like yajl2 for centos6 (which install into usual places), but this is additional work, and it seems, ofc, not related to you, except, that your package is not working (for very popular distro).

Btw, centos7 contains yajl-2.0.4, but I didn't try grive2 there, though.

Also, FYI, centos6 have by default boost-1.41.0, and boost148 (i.e. 1.48.0) as additional package in EPEL. Centos7 default is boost-1.53.0.

do11 commented 9 years ago

Btw, you didn't mention in README that cmake is also requirement.

I tried to compile grive2 on CentOS 7, JFF:

root@el7:~/grive2/build# yum install cmake libgcrypt-devel libcurl-devel expat-devel yajl-devel 
root@el7:~/grive2/build# yum install boost boost-devel
root@el7:~/grive2/build# cmake ..
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found libgcrypt: -lgcrypt -ldl -lgpg-error
-- Found CURL: /usr/lib64/libcurl.so (found version "7.29.0")
-- Found EXPAT: /usr/lib64/libexpat.so (found version "2.1.0")
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   unit_test_framework
--   regex
--   system
-- Found libbfd: /usr/lib64/libbfd.so
-- Found libiberty: /usr/lib64/libiberty.a
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- checking for module 'yajl'
--   found yajl, version 2.0.4
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   program_options
-- Configuring done
-- Generating done
-- Build files have been written to: /root/grive2/build
root@el7:~/grive2/build# make
...
[100%] Built target grive_executable
root@el7:~/grive2/build# ./grive/grive
Please run grive with the "-a" option if this is the first time you're accessing your Google Drive!

:thumbsup:

vitalif commented 9 years ago

Nor centos6, nor centos7 have /usr/local/lib into ld.so.conf* by default.

Maybe /usr/local/lib64 is included?

Btw, you didn't mention in README that cmake is also requirement.

...and also git and c++ compiler :) I've already stated it here http://yourcmc.ru/wiki/Grive2 and maybe you're right and I should add it in README...