blei-lab / dtm

This implements topics that change over time (Dynamic Topic Models) and a model of how individual documents predict that change.
GNU General Public License v2.0
199 stars 79 forks source link

Segmentation fault on Ubuntu 14.04 #3

Closed zygmuntz closed 8 years ago

zygmuntz commented 9 years ago

The program compiles with a bunch of warnings (below), but when ran there's a segmentation fault. How to fix it?

$ uname -a
Linux k2 3.13.0-55-generic #94-Ubuntu SMP Thu Jun 18 00:27:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

$ make
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o ss-lm.o ss-lm.c
ss-lm.c: In function ‘void write_sslm_var(sslm_var*, char*)’:
ss-lm.c:1296:45: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_int(f, "SEQ_LENGTH", var->T);
                                            ^
ss-lm.c:1297:44: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_int(f, "NUM_TERMS", var->W);
                                            ^
ss-lm.c:1298:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_double(f, "OBS_VARIANCE", var->obs_variance);
                                                            ^
ss-lm.c:1299:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_double(f, "CHAIN_VARIANCE", var->chain_variance);
                                                                ^
ss-lm.c: In function ‘sslm_var* read_sslm_var(char*)’:
ss-lm.c:1318:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_read_int(f, "SEQ_LENGTH", &T);
                                        ^
ss-lm.c:1319:39: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_read_int(f, "NUM_TERMS", &W);
                                    ^
ss-lm.c:1324:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_read_double(f, "OBS_VARIANCE", &(var->obs_variance));
                                                            ^
ss-lm.c:1325:67: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_read_double(f, "CHAIN_VARIANCE", &(var->chain_variance));
                                                                ^
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o gsl-wrappers.o gsl-wrappers.c
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o data.o data.c
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o param.o param.c
param.c:41:36: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
static  char *begin_restart_header="/***BEGIN_RESTART***/\n";
                                    ^
param.c:42:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
static  char *end_restart_header="/***END_RESTART***/\n";
                                ^
param.c:44:48: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
static  char *YesString[] = {"YES", "TRUE", "1"};
                                                ^
param.c:44:48: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
param.c:44:48: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
param.c: In function ‘void parse_stream(FILE*, char*)’:
param.c:159:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ddinf_link*’ [-Wformat=]
    printf("ddinf: %d\n", ddinf);
                            ^
param.c:180:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                    error("PARAM: ungetc failed.");
                                                    ^
param.c:192:37: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("PARAM: ungetc failed.");
                                    ^
param.c:208:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case COMMENT_END: ddinf_error("Unmatched comment ending");
                                                            ^
param.c:209:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DELIMITER: ddinf_error("Missing parameter name.");
                                                            ^
param.c:210:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case QUOTE: ddinf_error("Quotations for values only.");
                                                            ^
param.c:211:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DQUOTE: ddinf_error("Quotations for values only.");
                                                            ^
param.c:229:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case COMMENT_END: ddinf_error("Unmatched comment ending");
                                                            ^
param.c:230:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DELIMITER: ddinf_error("Missing parameter name.");
                                                            ^
param.c:231:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case QUOTE: ddinf_error("Quotations for values only.");
                                                            ^
param.c:232:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DQUOTE: ddinf_error("Quotations for values only.");
                                                            ^
param.c:233:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case ENDMARK: ddinf_error("Null production");
                                                ^
param.c:245:58: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        ddinf_error("Illegal character after end marker.");
                                                        ^
param.c:268:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case COMMENT_END: ddinf_error("Unmatched comment ending");
                                                            ^
param.c:269:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case QUOTE: ddinf_error("Quotes for values only.");
                                                        ^
param.c:270:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DQUOTE: ddinf_error("Quotes for values only.");
                                                        ^
param.c:274:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case ENDMARK: ddinf_error("Missing value.");
                                                ^
param.c:276:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        ddinf_error("Illegal use of COMMAND character.");
                                                        ^
param.c:278:54: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        ddinf_error("Illegal use of FIXIT character.");
                                                    ^
param.c:294:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        ddinf_error("Illegal character after parameter name.");
                                                            ^
param.c:306:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case COMMENT_END: ddinf_error("Unmatched comment ending");
                                                            ^
param.c:307:66: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case DELIMITER: ddinf_error("Missing delimiter or endmark.");
                                                                ^
param.c:312:64: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                    ddinf_error("error adding (name,value) pair");
                                                                ^
param.c:333:66: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    default: ddinf_error("Illegal character in ddinf directive");
                                                                ^
param.c:344:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case COMMENT_END: ddinf_error("Unmatched comment ending");
                                                            ^
param.c:350:41: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ddinf_error("Unable to open ddinf");
                                        ^
param.c:356:41: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ddinf_error("Unable to open ddinf");
                                        ^
param.c:367:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        else ddinf_error("Unrecognized ddinf directive.");
                                                        ^
param.c:369:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    case END_OF_LINE: ddinf_error("Missing end marker");
                                                        ^
param.c:390:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        case COMMENT_END: ddinf_error("Unmatched comment end.");
                                                            ^
param.c:395:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                    ddinf_error("error adding (name,value) pair");
                                                                ^
param.c:406:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ddinf_error("Illegal character after quotation.");
                                                    ^
param.c:417:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        case COMMENT_END: ddinf_error("Unmatched comment end.");
                                                            ^
param.c:422:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                    ddinf_error("error adding (name,value) pair");
                                                                ^
param.c:429:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ddinf_error("Illegal character after quotation.");
                                                    ^
param.c:432:52: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    ddinf_error("Illegal character after quotation.");
                                                    ^
param.c:440:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
            ddinf_error("end of file inside quoted string.");
                                                            ^
param.c:443:54: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
            ddinf_error("end of file inside comment.");
                                                    ^
param.c:446:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
            ddinf_error("Not in proper state at end of file.");
                                                            ^
param.c: In function ‘char* lookup_ddval(const char*, int*)’:
param.c:524:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    if (nopenparens>0) error("PARAM: Unmatched (");
                                                ^
param.c:532:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    error("PARAM: No nested %% allowed.");
                                        ^
param.c:535:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    error("PARAM: symbol %s not defined (yet)\n", ddparm);
                                                        ^
param.c: In function ‘ddlink* insert(const char*, const char*)’:
param.c:596:68: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("PARAM: Error: Symbol %s already fixed", lp->ddname);
                                                                    ^
param.c: In function ‘int param_checkpointed()’:
param.c:607:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    if (restart_is_new || qfilef(param_getc("%restart",""))==0)
                                                        ^
param.c: In function ‘ddinf_link* push_last_complete_block(char*)’:
param.c:642:55: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    error("PARAM: Unable to open restart %s", inname);
                                                    ^
param.c: In function ‘void param_init_restart()’:
param.c:670:70: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        restart_name = (char *) malloc(strlen(param_getc("%restart",""))+1);
                                                                    ^
param.c:671:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        strcpy(restart_name, param_getc("%restart",""));
                                                    ^
param.c:676:64: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("PARAM: Unable to open restart %s", restart_name);
                                                                ^
param.c:684:64: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("PARAM: Unable to open restart %s", restart_name);
                                                                ^
param.c: In function ‘ddinf_link* push_ddinf(char*)’:
param.c:709:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("PARAM: Unable to open ddinf %s", dl->name);
                                                        ^
param.c: In function ‘char* param_gets(const char*)’:
param.c:881:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
error("PARAM: variable %s not found.", var_name);
                                                ^
param.c: In function ‘void ddinf_error(char*)’:
param.c:934:54: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    error("ERROR IN DDINF=%s: %s", ddinf->name, ermsg);
                                                    ^
param.c: In function ‘long int safe_atol(const char*, const char*)’:
param.c:953:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        expr, name);
                ^
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o util.o util.c
util.c: In function ‘void error(char*, ...)’:
util.c:52:28: warning: format not a string literal and no format arguments [-Wformat-security]
        fprintf(stderr, buf);
                            ^
util.c: In function ‘char* dequote(char*)’:
util.c:98:55: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
        error("Illegal string passed to dequote: %s", s);
                                                    ^
util.c: In function ‘void* util_malloc(int)’:
util.c:236:73: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                                            space_in_use, pointers_in_use);
                                                                        ^
util.c: In function ‘void* util_calloc(int, int)’:
util.c:250:73: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                                            space_in_use, pointers_in_use);
                                                                        ^
util.c: In function ‘void* util_realloc(void*, int)’:
util.c:268:73: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
                                            space_in_use, pointers_in_use);
                                                                        ^
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o lda-seq.o lda-seq.c
In file included from lda-seq.c:12:0:
lda-seq.c:46:7: warning: overflow in implicit constant conversion [-Woverflow]
    1e20,
    ^
../lib/util/gflags-1.1/src/gflags/gflags.h:447:42: note: in definition of macro ‘DEFINE_VARIABLE’
    static const type FLAGS_nono##name = value;                 \
                                        ^
lda-seq.c:45:1: note: in expansion of macro ‘DEFINE_int32’
DEFINE_int32(save_time,
^
lda-seq.c: In function ‘double update_inf_var_fixed(lda_seq*, const corpus_seq_t*, gsl_matrix**, size_t, const char*, int)’:
lda-seq.c:479:55: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_sparse_gsl_matrix(f, "W_phi", W_phi);
                                                    ^
lda-seq.c:484:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_sparse_gsl_matrix(f, "W_phi_var", W_phi_var);
                                                            ^
lda-seq.c:489:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_gsl_matrix(f, "phi 0", phi[0]);
                                                ^
lda-seq.c:496:59: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_sparse_gsl_matrix(f, "W2_phi2", W2_phi2);
                                                        ^
lda-seq.c:501:70: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_gsl_vector_multiline(f, "weighted_response", d_tmp);
                                                                    ^
lda-seq.c:506:64: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_gsl_vector_multiline(f, "response", response);
                                                                ^
lda-seq.c:511:62: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    params_write_gsl_vector_multiline(f, "exp_h", exp_h_tmp);
                                                            ^
lda-seq.c:517:63: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_gsl_matrix(f, "document_document_matrix", dd_tmp);
                                                            ^
lda-seq.c:522:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_gsl_vector_multiline(f, "exp_h", exp_h_tmp);
                                                        ^
lda-seq.c: In function ‘void write_lda_seq(const lda_seq*, const char*)’:
lda-seq.c:1152:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_int(f, "NUM_TOPICS", model->ntopics);
                                                ^
lda-seq.c:1153:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_int(f, "NUM_TERMS", model->nterms);
                                                ^
lda-seq.c:1154:48: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_int(f, "SEQ_LENGTH", model->nseq);
                                                ^
lda-seq.c:1155:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_write_gsl_vector(f, "ALPHA", model->alpha);
                                                ^
lda-seq.c: In function ‘lda_seq* read_lda_seq(const char*, corpus_seq_t*)’:
lda-seq.c:1200:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_read_int(f, "NUM_TOPICS", &(model->ntopics));
                                                    ^
lda-seq.c:1201:51: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_read_int(f, "NUM_TERMS", &(model->nterms));
                                                ^
lda-seq.c:1202:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_read_int(f, "SEQ_LENGTH", &(model->nseq));
                                                ^
lda-seq.c:1203:53: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
params_read_gsl_vector(f, "ALPHA", &(model->alpha));
                                                    ^
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o lda.o lda.c
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o params.o params.c
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags   -c -o main.o main.c
g++ -c -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags \
        ../lib/util/gflags-1.1/src/gflags.cc \
        ../lib/util/gflags-1.1/src/gflags_reporting.cc \
        ../lib/util/gflags-1.1/src/gflags_completions.cc
g++ -I ../lib -I ../lib/math -I ../gslwrap/include -I ../gslwrap/include/gslwrap -I ../local/include -I ../lib/util/gflags-1.1/src/gflags ss-lm.o gsl-wrappers.o data.o param.o util.o lda-seq.o lda.o params.o main.o gflags.o gflags_reporting.o gflags_completions.o -o main -L../local/lib -L../local/lib/stl -lgsl -lm -lgslcblas

$ ./main
Segmentation fault
RianaChen commented 8 years ago

I have the same problem... Do u find way to solve it?

zygmuntz commented 8 years ago

No.

RianaChen commented 8 years ago

Hv u successfully install the dependence( dsl )? I've tried on my mac os but on Ubuntu it doesn't work.

dajunxiao commented 8 years ago

I also have the same problem .

RichardeJiang commented 8 years ago

Same problem here. On Mac OS it can be run, but on server (running CentOS) after make if I perform ./main --help it gives segmentation fault. Make doesn't give any error messages.

RichardeJiang commented 8 years ago

Okay for anyone who might really need to run it, just an alternative (not a solution): try using Ubuntu 10.04 (the one they use for developing). It might cause issues when installing (like the USB3.0 failure), so just run it in a virtual machine.

mcallaghan commented 8 years ago

The old google code archive has a patch which seems to fix this for me on Ubuntu 14.04.

"DTM compiles but segfaults immediately; the default of 0 for initialize_lda should instead be false"