Skip to content

Undefined symbol rocksdb::CreateDBStatistics() #26

Closed

Description

@spiritloose

Hi,

I got an error when compiling the following my test program.

Undefined symbols for architecture x86_64:
  "rocksdb::CreateDBStatistics()", referenced from:
      _main in test-5grmFu.o
ld: symbol(s) not found for architecture x86_64

This function is used only for testing?

Regards,

#include <cassert>
#include <rocksdb/db.h>
#include <rocksdb/statistics.h>

int main() {
    rocksdb::DB* db;
    rocksdb::Options options;
    options.create_if_missing = true;
    options.statistics = rocksdb::CreateDBStatistics();
    rocksdb::Status status = rocksdb::DB::Open(options, "/tmp/rocks.db", &db);
    assert(status.ok());
    return 0;
}

Activity

  1. liukai commented on Dec 5, 2013

    @liukai
    Contributor

    @spiritloose can you give us some information about your development environment?

  2. spiritloose commented on Dec 6, 2013

    @spiritloose
    Author

    @liukai My development environments are:

    Mac OS X Mavericks

    $ cat .git/refs/heads/master ; uname -a ; g++ -v
    92e8316118b8bf330e1e7f025252be380940e941
    Darwin jiro.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
    Target: x86_64-apple-darwin13.0.0
    Thread model: posix
    

    Ubuntu 13.10 (Saucy Salamander) x86_64 on Virtual Box (host is Mac)

    $ cat .git/refs/heads/master ; uname -a ; g++ -v
    92e8316118b8bf330e1e7f025252be380940e941
    Linux vagrant-ubuntu-saucy-64 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    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-10ubuntu9' --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-10ubuntu9)
    

    I think that any one cc file which is linked should #include "db/db_statistics.h" to make the function public.

    Regards,

  3. liukai commented on Dec 6, 2013

    @liukai
    Contributor

    I got your point @spiritloose, I submitted a diff and hope that can help you to solve the problem.

  4. spiritloose commented on Dec 6, 2013

    @spiritloose
    Author

    Thanks! I already confirmed that diff!

  5. added a commit that references this issue on May 14, 2014
  6. added 2 commits that reference this issue on Sep 3, 2021
  7. 2 remaining items

  8. added a commit that references this issue on Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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