bizstation / transactd

The high-speed and advanced NoSQL interface plugin for MySQL / MariaDB.
GNU General Public License v2.0
18 stars 1 forks source link

C++ client becomes segmentation fault on Fedora19 #1

Closed kjdev closed 11 years ago

kjdev commented 11 years ago

Environment

cd ~/transactd
sed -i 's/Boost_USE_STATIC_LIBS ON/Boost_USE_STATIC_LIBS OFF/' build/common/transactd_common.cmake
mkdir bldgccx64
cd bldgccx64
cmake .. -DWITH_TRANSACTD_SERVER=OFF -DWITH_TRANSACTD_CLIENTS=ON \
  -DBOOST_ROOT=/usr/include/boost \
  -DTRANSACTD_CLIENTS_PREFIX=/usr/lib64 \
  -DTRANSACTD_PREFIX=/usr/share/transactd

Create transactd C++

#include <stdio.h>

#define LINUX 1 //Could not compile If you do not define

#include <bzs/db/protocol/tdap/client/database.h>

using namespace bzs::db::protocol::tdap::client;

int main(int argc, char **argv) {
    database* db = database::create();
    database::destroy(db);
    return 0;
}

Build

gcc -Wall \
  -I/path/to/transactd/source -I/path/to/transactd/source/linux \
  -L/path/to/transactd/bldgccx64/build/tdclcppm/ \
  -Xlinker -rpath -Xlinker /path/to/transactd/bldgccx64/build/tdclcppm/ \
  -ltdclcpp_64m -lstdc++ -ldl \
  main.cpp

Execute

./a.out
segmentation fault  ./a.out
gdb ./a.out
(gdb) r
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7dbf02f in bzs::db::protocol::tdap::client::nsdatabase::getBtrVersion(bzs::db::protocol::tdap::btrVersions*, unsigned char*) ()
   from /path/to/transactd/bldgccx64/build/tdclcppm/libtdclcpp_64m.so.1.1
#2  0x00007ffff7dbde35 in bzs::db::protocol::tdap::client::nsdatabase::nsdatabase() ()
   from /path/to/transactd/bldgccx64/build/tdclcppm/libtdclcpp_64m.so.1.1
#3  0x00007ffff7db1285 in bzs::db::protocol::tdap::client::database::database()
    ()
   from /path/to/transactd/bldgccx64/build/tdclcppm/libtdclcpp_64m.so.1.1
#4  0x00007ffff7db532c in bzs::db::protocol::tdap::client::database::create() ()
   from /path/to/transactd/bldgccx64/build/tdclcppm/libtdclcpp_64m.so.1.1
#5  0x00000000004007b4 in main ()
bizstation commented 11 years ago

Hi, kjdev. Thank you for reports.

First, please check that: libtdclcpp_64m will load libtdclc_64.so.1.0 dynamically with dlopen (or LoadLibrary). _libtdclc64.so.1.0 must be on library load path. Please check if it exists.

Regards, Kosaka@BizStation

kjdev commented 11 years ago

Thanks, Kosaka.

It was possible we place where you can load and libtdclcpp_64m.so.1.1 libtdclc_64.so.1.0.

bizstation commented 11 years ago

Hi, kjdev.

I'm so glad that your problem has been solved. We will improve the documents about this point. Thank you for reporting.

Regards, Kosaka@BizStation