xrb92 / DKRL

Representation Learning of Knowledge Graphs with Entity Descriptions (AAAI'16)
231 stars 58 forks source link

Can't compile #12

Open samithaj opened 7 years ago

samithaj commented 7 years ago

`➜ DKRL-master make g++ Train_cnn_multi.cpp -o Train_cnn_multi -O2 -lpthread Train_cnn_multi.cpp:296:14: error: expected expression mut_mutex = PTHREAD_MUTEX_INITIALIZER; ^ /usr/include/pthread.h:182:35: note: expanded from macro 'PTHREAD_MUTEX_INITIALIZER'

define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}

                              ^

Train_cnn_multi.cpp:491:49: warning: cast to 'void ' from smaller integer type 'int' [-Wint-to-void-pointer-cast] pthread_create(&threads[k], NULL, rand_sel, (void )k); //train ^ Train_cnn_multi.cpp:499:53: warning: cast to 'void ' from smaller integer type 'int' [-Wint-to-void-pointer-cast] pthread_create(&threads2[k], NULL, update_grad, (void )k); //update ^ Train_cnn_multi.cpp:953:4: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ Train_cnn_multi.cpp:963:4: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ 4 warnings and 1 error generated. make: *** [Train_cnn_multi] Error 1`

when i replace line 296
mut_mutex = PTHREAD_MUTEX_INITIALIZER; with mut_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; it gives ➜ DKRL-master sudo ./Train_cnn_multi size = 50 size of layer1 = 50 size of word = 50 learing rate = 0.001 margin = 1 method = bern [1] 1266 segmentation fault sudo ./Train_cnn_multi

vhenk commented 6 years ago

I have a similar problem. I am able to compile the code but every time I run it, it aborts with the error message Segmentation fault: 11

Can somebody please help me? I really want to use this tool.

zy158 commented 5 years ago

@samithaj pthread_mutex_t needs to be initialized at the time of declaration:pthread_mutex_t mut_mutex = PTHREAD_MUTEX_INITIALIZER But I also meet the question:Segmentation fault: 11

vhenk commented 5 years ago

@zy158 Did you generate the vectorfile and give the correct path to it? This solved the problem for me.

But I also meet the question:Segmentation fault: 11

cxjtju commented 5 years ago

@vhenk Did you have finished this problem? I also meet the error Segmentation fault: 11