Problems compiling on Raspbian #168

Open
sledge1977 opened this Issue May 4, 2013 · 18 comments

Projects

None yet
@sledge1977

Hi,

I followed the instructions on this page
http://www.stuffaboutcode.com/2013/03/raspberry-pi-google-drive-grive.html
to compile grive on Raspbian.
But I get the following errors during linking of the grive exectuable.

Haven't found a solution to this problem.

Thanks

Linking CXX executable grive
../libgrive/libgrive.a(State.cc.o): In function gr::v1::State::Write(boost::filesystem3::path const&) const': State.cc:(.text+0x19bc): undefined reference togr::Json::Json(long const&)'
State.cc:(.text+0x1a4c): undefined reference to gr::Json::Json<unsigned long>(unsigned long const&)' State.cc:(.text+0x1b2c): undefined reference togr::Json::Json(long const&)'
collect2: ld returned 1 exit status
make[2]: *** [grive/grive] Fehler 1
make[1]: *** [grive/CMakeFiles/grive_executable.dir/all] Fehler 2
make: *** [all] Fehler 2

@nestal
Member
nestal commented May 4, 2013

It's likely related to size of long long in raspbian.
On May 4, 2013 6:33 PM, "sledge1977" notifications@github.com wrote:

Hi,

I followed the instructions on this page
http://www.stuffaboutcode.com/2013/03/raspberry-pi-google-drive-grive.html
to compile grive on Raspbian.
But I get the following errors during linking of the grive exectuable.

Haven't found a solution to this problem.

Thanks

Linking CXX executable grive
../libgrive/libgrive.a(State.cc.o): In function gr::v1::State::Write(boost::filesystem3::path
const&) const':
State.cc:(.text+0x19bc): undefined reference togr::Json::Json(long
const&)'
State.cc:(.text+0x1a4c): undefined reference to gr::Json::Json(unsigned long const&)'
State.cc:(.text+0x1b2c): undefined reference togr::Json::Json(long
const&)'
collect2: ld returned 1 exit status
make[2]: *** [grive/grive] Fehler 1
make[1]: *** [grive/CMakeFiles/grive_executable.dir/all] Fehler 2
make: *** [all] Fehler 2


Reply to this email directly or view it on GitHubhttps://github.com/Grive/grive/issues/168
.

@sledge1977

The instructions show how to compile on Raspbian, so I think it should work.
Do I have to set some specific parameters or something?

@sledge1977

Any ideas?
Tried everything again and again, but still no luck.
It looks like he is missing something during linking. But what?

@tkoe
tkoe commented May 8, 2013

I can confirm this problem on a dockstar with a current Debian Wheezy.
Linux dockstar 3.2.0-4-kirkwood #1 Debian 3.2.41-2 armv5tel GNU/Linux

@chubbyupchuck

This is also a problem on Lubuntu 13.04 32 bit. It seems to be caused by 3 missing casts to boost::uint64_t on lines 251, 252 and 256 of State.cc. Presumably to do with the size of longs as suggested sledge1977. Changing State::Write to...

void State::Write( const fs::path& filename ) const
{
Json last_sync ;
last_sync.Add( "sec", Json((boost::uint64_t) m_last_sync.Sec() ) );
last_sync.Add( "nsec", Json((boost::uint64_t) m_last_sync.NanoSec() ) );

Json result ;
result.Add( "last_sync", last_sync ) ;
result.Add( "change_stamp", Json((boost::uint64_t) m_cstamp) ) ;

std::ofstream fs( filename.string().c_str() ) ;
fs << result ;

}

fixes compilation for me. Obviously your mileage may vary.

@sledge1977

Finally. Thank you very much. That worked on Raspbian aswell.

@Snoopinator

Thank you, it worked also for me on Raspbian.

@azeemba
azeemba commented May 18, 2013

I had the same error on Linux Mint and the casting fix allowed me to compile it successfully.

@yoanisgil

I had the same error on Debian Squeeze and this solution worked for me.

@o4114o
o4114o commented Jul 3, 2013

Thank you. this also works on Centos 6.3.

@whitemax

Hello,
I'm a complete moron. which file i must edit to fix this problem?
thanks

@alexandersgreen

libgrive/src/drive/State.cc

@mesmariusz

Doesnt work for me :-(

I'm trying to install grive follow instruction:
http://www.stuffaboutcode.com/2013/03/raspberry-pi-google-drive-grive.html.

But finnaly I have got

[b]Linking CXX executable grive
../libgrive/libgrive.a(State.cc.o): In function gr::v1::State::Write(boost::filesystem::path const&) const':
State.cc:(.text+0x19bc): undefined reference togr::Json::Json(long const&)'
State.cc:(.text+0x1a4c): undefined reference to gr::Json::Json(unsigned long const&)'
State.cc:(.text+0x1b2c): undefined reference togr::Json::Json(long const&)'
collect2: ld returned 1 exit status
make[2]: *** [grive/grive] Błąd 1
make[1]: *** [grive/CMakeFiles/grive_executable.dir/all] Błąd 2
make: *** [all] Błąd 2[/b]

[code]
root@raspberrypi:/# cd root
root@raspberrypi:# cd grive
root@raspberrypi:
/grive# cmake .
-- Found libgcrypt: -L/lib/arm-linux-gnueabihf -lgcrypt
-- Found JSON-C: /usr/lib/arm-linux-gnueabihf/libjson.so
-- Boost version: 1.50.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- unit_test_framework
-- system
-- Found libbfd: /usr/lib/libbfd.so
-- Found libiberty: /usr/lib/libiberty.a
-- Boost version: 1.50.0
-- Found the following Boost libraries:
-- program_options
-- Boost version: 1.50.0
-- Configuring done
-- Generating done
-- Build files have been written to: /root/grive
root@raspberrypi:/grive# make
[ 1%] Building CXX object libgrive/CMakeFiles/grive.dir/src/http/ResponseLog.cc.o
[ 3%] Building CXX object libgrive/CMakeFiles/grive.dir/src/http/Download.cc.o
[ 5%] Building CXX object libgrive/CMakeFiles/grive.dir/src/protocol/JsonResponse.cc.o
[ 7%] Building CXX object libgrive/CMakeFiles/grive.dir/src/protocol/Json.cc.o
[ 8%] Building CXX object libgrive/CMakeFiles/grive.dir/src/protocol/AuthAgent.cc.o
[ 10%] Building CXX object libgrive/CMakeFiles/grive.dir/src/protocol/OAuth2.cc.o
[ 12%] Building CXX object libgrive/CMakeFiles/grive.dir/src/json/JsonWriter.cc.o
[ 14%] Building CXX object libgrive/CMakeFiles/grive.dir/src/json/ValResponse.cc.o
[ 16%] Building CXX object libgrive/CMakeFiles/grive.dir/src/json/ValBuilder.cc.o
[ 17%] Building CXX object libgrive/CMakeFiles/grive.dir/src/json/JsonParser.cc.o
[ 19%] Building CXX object libgrive/CMakeFiles/grive.dir/src/json/Val.cc.o
[ 21%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/MemMap.cc.o
[ 23%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/Config.cc.o
[ 25%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/StringStream.cc.o
[ 26%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/Crypt.cc.o
[ 28%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/File.cc.o
[ 30%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/OS.cc.o
[ 32%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/SignalHandler.cc.o
[ 33%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/StdStream.cc.o
[ 35%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/Exception.cc.o
[ 37%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/DateTime.cc.o
[ 39%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/log/CommonLog.cc.o
[ 41%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/log/DefaultLog.cc.o
[ 42%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/log/Log.cc.o
[ 44%] Building CXX object libgrive/CMakeFiles/grive.dir/src/util/log/CompositeLog.cc.o
[ 46%] Building CXX object libgrive/CMakeFiles/grive.dir/src/xml/TreeBuilder.cc.o
[ 48%] Building CXX object libgrive/CMakeFiles/grive.dir/src/xml/NodeSet.cc.o
[ 50%] Building CXX object libgrive/CMakeFiles/grive.dir/src/xml/Node.cc.o
[ 51%] Building CXX object libgrive/CMakeFiles/grive.dir/src/xml/String.cc.o
[ 53%] Building CXX object libgrive/CMakeFiles/grive.dir/src/bfd/SymbolInfo.cc.o
[ 55%] Building CXX object libgrive/CMakeFiles/grive.dir/src/bfd/Backtrace.cc.o
[ 57%] Building CXX object libgrive/CMakeFiles/grive.dir/src/bfd/Debug.cc.o
Linking CXX static library libgrive.a
[ 82%] Built target grive
Scanning dependencies of target btest
[ 83%] Building CXX object libgrive/CMakeFiles/btest.dir/test/btest/UnitTest.cc.o
[ 85%] Building CXX object libgrive/CMakeFiles/btest.dir/test/btest/ValTest.cc.o
[ 87%] Building CXX object libgrive/CMakeFiles/btest.dir/test/btest/JsonValTest.cc.o
Linking CXX executable btest
[ 87%] Built target btest
Scanning dependencies of target grive_executable
[ 89%] Building CXX object grive/CMakeFiles/grive_executable.dir/src/main.cc.o
Linking CXX executable grive
../libgrive/libgrive.a(State.cc.o): In function gr::v1::State::Write(boost::filesystem::path const&) const':
State.cc:(.text+0x19bc): undefined reference togr::Json::Json(long const&)'
State.cc:(.text+0x1a4c): undefined reference to gr::Json::Json(unsigned long const&)'
State.cc:(.text+0x1b2c): undefined reference togr::Json::Json(long const&)'
collect2: ld returned 1 exit status
make[2]: *** [grive/grive] Błąd 1
make[1]: *** [grive/CMakeFiles/grive_executable.dir/all] Błąd 2
make: *** [all] Błąd 2
root@raspberrypi:
/grive#[/code]

I found it explained:

#168

so I replaced faulty line inside libgrive/src/drive/State.cc by this:

[code]result.Add( "change_stamp", Json((boost::uint64_t) m_cstamp) ) ; [/code]

But the effect was:

[code]root@raspberrypi:/grive# make
Scanning dependencies of target grive
[ 1%] Building CXX object libgrive/CMakeFiles/grive.dir/src/drive/State.cc.o
Linking CXX static library libgrive.a
[ 82%] Built target grive
Linking CXX executable btest
[ 87%] Built target btest
Scanning dependencies of target grive_executable
[ 89%] Building CXX object grive/CMakeFiles/grive_executable.dir/src/main.cc.o
Linking CXX executable grive
../libgrive/libgrive.a(State.cc.o): In function gr::v1::State::Write(boost::filesystem::path const&) const':
State.cc:(.text+0x19bc): undefined reference togr::Json::Json(long const&)'
State.cc:(.text+0x1a4c): undefined reference to `gr::Json::Json(unsigned long const&)'
collect2: ld returned 1 exit status
make[2]: *** [grive/grive] Błąd 1
make[1]: *** [grive/CMakeFiles/grive_executable.dir/all] Błąd 2
make: *** [all] Błąd 2
root@raspberrypi:
/grive# [/code]

Could someone please help me?

I need working sollution for backup my Raspberry Pi folders into Google Drive...

@alexandersgreen

There are three lines that you need to change in that file. See the post by chubbyupchuck above.

@mesmariusz

Ok. I deleted function State and then inserted it again from this post above.

void State::Write( const fs::path& filename ) const
{
Json last_sync ;
last_sync.Add( "sec", Json((boost::uint64_t) m_last_sync.Sec() ) );
last_sync.Add( "nsec", Json((boost::uint64_t) m_last_sync.NanoSec() ) );

Json result ;
result.Add( "last_sync", last_sync ) ;
result.Add( "change_stamp", Json((boost::uint64_t) m_cstamp) ) ;

std::ofstream fs( filename.string().c_str() ) ;
fs << result ;
}

I'm trying to compile it again. We wil see...

@mesmariusz

Finally, lived to see it working!

root@raspberrypi:/grive# cmake .
-- Found libgcrypt: -L/lib/arm-linux-gnueabihf -lgcrypt
-- Found JSON-C: /usr/lib/arm-linux-gnueabihf/libjson.so
-- Boost version: 1.50.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- unit_test_framework
-- system
-- Found libbfd: /usr/lib/libbfd.so
-- Found libiberty: /usr/lib/libiberty.a
-- Boost version: 1.50.0
-- Found the following Boost libraries:
-- program_options
-- Boost version: 1.50.0
-- Configuring done
-- Generating done
-- Build files have been written to: /root/grive
root@raspberrypi:
/grive# make
Scanning dependencies of target grive
[ 1%] Building CXX object libgrive/CMakeFiles/grive.dir/src/drive/State.cc.o
Linking CXX static library libgrive.a
[ 82%] Built target grive
Linking CXX executable btest
[ 87%] Built target btest
Linking CXX executable grive
[ 89%] Built target grive_executable
[ 91%] Generating src/moc_MainWnd.cxx
[ 92%] Generating ui_MainWindow.h
Scanning dependencies of target bgrive_executable
[ 94%] Building CXX object bgrive/CMakeFiles/bgrive_executable.dir/src/main.cc.o
[ 96%] Building CXX object bgrive/CMakeFiles/bgrive_executable.dir/src/DriveModel.cc.o
[ 98%] Building CXX object bgrive/CMakeFiles/bgrive_executable.dir/src/MainWnd.cc.o
[100%] Building CXX object bgrive/CMakeFiles/bgrive_executable.dir/src/moc_MainWnd.cxx.o
Linking CXX executable bgrive
[100%] Built target bgrive_executable

Great!
Thanks a lot!

@ahibal
ahibal commented Jun 4, 2014

Thank you chubbyupchuck I used your information for antix debian based distro

@Nishantkashiv

Thanks chubbyupchuck you are great!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment