Skip to content

compile error on Ubuntu #4

Closed
Closed

Description

@kgcrom

Thanks for makes this project.

I'm tried to compile rocksdb on Ubuntu 12.04 LTS, but I got an error message.

g++ -g -Wall -Werror -I. -I./include -DOS_LINUX -fno-builtin-memcmp -DLEVELDB_PLATFORM_POSIX -DGFLAGS -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -std=gnu++0x -Woverloaded-virtual -c db/db_test.cc -o db/db_test.o 
In file included from db/db_test.cc:27:0:
db/db_test.cc: In member function ‘void rocksdb::_Test_TransactionLogIteratorCorruptedLog::_Run()’:
db/db_test.cc:4108:75: error: ‘truncate’ was not declared in this scope
       truncate(logfilePath.c_str(), wal_files.front()->SizeFileBytes() / 2)     
                                                                           ^
./util/testharness.h:111:78: note: in definition of macro ‘ASSERT_EQ’
 #define ASSERT_EQ(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsEq((a),(b))
                                                                              ^
make: *** [db/db_test.o] Error 1

so add below code.

#include <unistd.h>
#include <sys/types.h>

Am I wrong?

Activity

  1. igorcanadi commented on Nov 16, 2013

    @igorcanadi
    Contributor

    What version of g++ are you using? Can you try upgrading to 4.7 or 4.8?

  2. kgcrom commented on Nov 16, 2013

    @kgcrom
    Author

    I'm using 4.8.1.

    kgcrom@lucas:~/sponge$ g++ --version
    g++ (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    

    Have you finised compile without above header?

  3. dyu commented on Nov 17, 2013

    @dyu
    Contributor

    I'm getting these erros:
    db/db_bench.cc:14:27: fatal error: gflags/gflags.h: No such file or directory
    compilation terminated.

    on ubuntu 13.04 gcc 4.7.3

  4. mdcallag commented on Nov 17, 2013

    @mdcallag
    Contributor

    Do you need to install gflags? Is that a dependency we need to document?

    On a recent ubuntu 12.10 install I had to do:
    sudo apt-get install libgflags-dev


    And I also had to add this to db/db_test.cc for the default (debug?) build
    to define "truncate".

    diff --git a/db/db_test.cc b/db/db_test.cc
    index e246798..2f1a1e3 100644
    --- a/db/db_test.cc
    +++ b/db/db_test.cc
    @@ -27,6 +27,7 @@
    #include "util/testharness.h"
    #include "util/testutil.h"
    #include "utilities/merge_operators.h"
    +#include <unistd.h>

    namespace rocksdb {

    On Sun, Nov 17, 2013 at 3:03 AM, David Yu [email protected] wrote:

    I'm getting these erros:
    db/db_bench.cc:14:27: fatal error: gflags/gflags.h: No such file or
    directory
    compilation terminated.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-28646477
    .

    Mark Callaghan
    [email protected]

  5. mdcallag commented on Nov 17, 2013

    @mdcallag
    Contributor

    Yes, need to add "include <unistd.h>" to fix he compile failure

  6. vinothchandar commented on Nov 17, 2013

    @vinothchandar

    I am trying to add a storage engine to Voldemort based on rocksdb. Also running into trouble compiling snappy on Ubuntu 12.04 LTS. Seems like the makefile has some hardcoded paths..

    $:~/projects/rocksdb/snappy/snappy-1.0.5$ make
    CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/dhruba/local/externals/java/leveldb/source/snappy-1.0.5/missing --run aclocal-1.11 -I m4
    /bin/sh: 0: Can't open /home/dhruba/local/externals/java/leveldb/source/snappy-1.0.5/missing
    make: *** [aclocal.m4] Error 12
    $:~/projects/rocksdb/snappy/snappy-1.0.5$ grep -Ri "dhruba" Makefile | wc -l
    11
    

    It would be great if you guys can put together a guide on building..

  7. igorcanadi commented on Nov 17, 2013

    @igorcanadi
    Contributor

    Working on it ;)

  8. igorcanadi commented on Nov 18, 2013

    @igorcanadi
    Contributor

    Can you please try compiling on Ubuntu now? I am able to compile and run on Ubuntu 12.04.

  9. dyu commented on Nov 18, 2013

    @dyu
    Contributor

    A complete list of dependencies (required and optional) would be a good start.
    The docs has been pretty good so far except for install/build docs :-)

    I successfully compiled after installing libgflags-dev (thanks @mdcallag).

  10. vinothchandar commented on Nov 18, 2013

    @vinothchandar

    Works now.. Thanks guys!

    For others: On a fresh 12.04 LTS, the process is as roughly follows

    1. sudo apt-get install libsnappy-dev
    2. Upgrade gcc/g++ to 4.8
    See http://askubuntu.com/questions/312620/how-do-i-install-gcc-4-8-1-on-ubuntu-13-04
    (it is for 13.04. but the process is common I think)
    3. sudo apt-get install build-essentials devscripts
    4. Install gflags
    (its not 1-command if you are < 12.10)
    see http://askubuntu.com/questions/312173/installing-gflags-12-04?rq=1
    
    
    

    then make, make install in rocksdb and done.

  11. mdcallag commented on Nov 18, 2013

    @mdcallag
    Contributor

    I don't think gcc 4.8 is required. I compile with 4.7.2 using Ubuntu 12.10

    On Mon, Nov 18, 2013 at 6:52 AM, vinoth chandar [email protected]:

    Works now.. Thanks guys!

    For others: On a fresh 12.04 LTS, the process is as roughly follows

    1. sudo apt-get install libsnappy-dev

    2. Upgrade gcc/g++ to 4.8
      See http://askubuntu.com/questions/312620/how-do-i-install-gcc-4-8-1-on-ubuntu-13-04
      (it is for 13.04. but the process is common I think)

    3. Install gflags
      (its not 1-command if you are < 12.10)
      see http://askubuntu.com/questions/312173/installing-gflags-12-04?rq=1

      then make, make install in rocksdb and done.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-28703440
    .

    Mark Callaghan
    [email protected]

  12. kgcrom commented on Nov 18, 2013

    @kgcrom
    Author

    @igorcanadi @vinothchandar 👍 with only install build-essentials and upgrade gcc/g++, install gflags

    Thank you

  13. igorcanadi commented on Nov 18, 2013

    @igorcanadi
    Contributor

    Added INSTALL.md: https://github.com/facebook/rocksdb/blob/master/INSTALL.md

    I hope this is resolved. Let us know if you are still having issues.

  14. 101 remaining items

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions