Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译问题 #18

Open
miketang84 opened this issue Jan 19, 2013 · 13 comments
Open

编译问题 #18

miketang84 opened this issue Jan 19, 2013 · 13 comments

Comments

@miketang84
Copy link

平台为Ubuntu 12.04 x64

严格按说明安装的:

在做到
make MALLOC=tcmalloc_minimal
时,报如下错误:

/usr/bin/ld: ../deps/gperftools-2.0/.libs/libtcmalloc_minimal.a(libtcmalloc_minimal_internal_la-malloc_extension.o): undefined reference to symbol 'std::basic_string<char, std::char_traits, std::allocator >::_Rep::_M_destroy(std::allocator const&)@@GLIBCXX_3.4'
/usr/bin/ld: note: 'std::basic_string<char, std::char_traits, std::allocator >::_Rep::_M_destroy(std::allocator const&)@@GLIBCXX_3.4' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so: could not read symbols: Invalid operation
collect2: ld 返回 1
make[1]: *** [redis-server] 错误 1
make[1]:正在离开目录 `/home/xen/Packages/redis-storage/redis-storage-master/src'
make: *** [all] 错误 2

麻烦检查下是需要在哪里加-fPIC呢?

@rchunping
Copy link
Contributor

呵呵,我也遇到过,gcc 4.1.x版本的吧

src/Makefile 里面
找到下面的地方,加上 -ldl -lstdc++ -lm

ifeq ($(MALLOC),tcmalloc_minimal)
FINAL_CFLAGS+= -DUSE_TCMALLOC
FINAL_LIBS+= ../deps/gperftools-2.0/.libs/libtcmalloc_minimal.a -ldl -lstdc++ -lm
endif

@miketang84
Copy link
Author

OK,好了,谢谢啊!可以试着用啦。

PS:什么时候,zset的ds指令能加上呢?

@rchunping
Copy link
Contributor

你试试看ds_exists命令正不正常,我这边老版的leveldb+ds_exists不太正常,需要修改代码

ds_set m 1
ds_exists a <-- 这里如果输出1说明有问题

@miketang84
Copy link
Author

我现在进不了,一进就崩溃退出。

2013/1/19 rchunping [email protected]

你试试看ds_exists命令正不正常,我这边老版的leveldb+ds_exists不太正常,需要修改代码

ds_set m 1
ds_exists a <-- 这里如果输出1说明有问题


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-12452190.

Nothing is impossible.

@rchunping
Copy link
Contributor

是不是没指定配置文件?

@miketang84
Copy link
Author

晕,确实没指定。跟redis默认不一样啊。现在启起来了。

2013/1/19 Tang Daogang [email protected]

我现在进不了,一进就崩溃退出。

2013/1/19 rchunping [email protected]

你试试看ds_exists命令正不正常,我这边老版的leveldb+ds_exists不太正常,需要修改代码

ds_set m 1
ds_exists a <-- 这里如果输出1说明有问题


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-12452190.

Nothing is impossible.

Nothing is impossible.

@miketang84
Copy link
Author

xen@T410s:~/Packages/redis-storage/redis-storage-master/src$ ./redis-cli
redis 127.0.0.1:6379> ds_set m 1
OK
redis 127.0.0.1:6379> ds_exists a

  1. (integer) 1
    redis 127.0.0.1:6379>

是正常还是不正常?

@rchunping
Copy link
Contributor

呵呵,明显不正常啊,你只存了m,没有存a,应该返回1)(integer)0才对。 新版还有一些问题,没有经过广泛严格的测试,应该建议七夜他们做几个稳定版分支。

你把 src/ds.c中 void ds_exists(redisClient *c) 函数

void ds_exists(redisClient *c)
{
int                   i;
char                  *err;
leveldb_iterator_t    *iter;

iter     = leveldb_create_iterator(server.ds_db, server.roptions);
addReplyMultiBulkLen(c, c->argc-1);
for(i=1; i<c->argc; i++)
{
    leveldb_iter_seek(iter, c->argv[i]->ptr, sdslen((sds)c->argv[i]->ptr));
    if(leveldb_iter_valid(iter))
        addReplyLongLong(c, 1);
    else
        addReplyLongLong(c, 0);
}

err = NULL;
leveldb_iter_get_error(iter, &err);
leveldb_iter_destroy(iter);

if(err != NULL)
{
    addReplyError(c, err);
    leveldb_free(err);

    return ;
}

return ;
}

改成

void ds_exists(redisClient *c)
{
int                   i;
char                  *err;
leveldb_iterator_t    *iter;
 char *kp;size_t kl;

iter     = leveldb_create_iterator(server.ds_db, server.roptions);
addReplyMultiBulkLen(c, c->argc-1);
for(i=1; i<c->argc; i++)
{
    leveldb_iter_seek(iter, c->argv[i]->ptr, sdslen((sds)c->argv[i]->ptr));

    if(leveldb_iter_valid(iter)){
    kp = leveldb_iter_key(iter,&kl);
    if( sdslen((sds)c->argv[i]->ptr) == kl && 0 == memcmp(c->argv[i]->ptr,kp,kl))
      addReplyLongLong(c,1);
    else
      addReplyLongLong(c,0);
  }else
    addReplyLongLong(c, 0);

}

err = NULL;
leveldb_iter_get_error(iter, &err);
leveldb_iter_destroy(iter);

if(err != NULL)
{
    addReplyError(c, err);
    leveldb_free(err);

    return ;
}

return ;
}

重新编译 ds_exists应该就正常了。

ds_hexists应该也有同样bug,我用不到这些功能所以就没改

@miketang84
Copy link
Author

好的。看来不敢用了。

我其实最急切的是要用到 redis 中换成 luajit 的功能。所以,结合本项目,还有 https://github.com/neomantra/redis

我整了个基于 redis 2.6的项目分支。需要的可以参考下。
https://github.com/daogangtang/redis_luajit2.6

我整这个,主要也是想给 https://github.com/daogangtang/bamboo 这个项目使用。这两个项目之间,会传送 字节码,所以,需要双方的lua引擎保持一致。

@qiye
Copy link
Owner

qiye commented Jan 28, 2013

haha.就是一些小bug. 可以很快改好的。

@qiye
Copy link
Owner

qiye commented Jan 29, 2013

下载最新代码。问题已经解决

@miketang84
Copy link
Author

好。redis的冷数据问题的解决方案就看七夜这个咯~~~

我很看好你哦。不过,我还需要支持 zset 的那些指令。七夜看能否抽点时间写下~~~~

On Tue, Jan 29, 2013 at 10:45 AM, qiye [email protected] wrote:

下载最新代码。问题已经解决


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-12817929.

Nothing is impossible.

@qiye
Copy link
Owner

qiye commented Jan 30, 2013

好的,没问题。这几天工作忙了一点。这几星期。我写一下zset的功能。谢谢大家的帮助

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants