stanfordnlp / GloVe

Software in C and data files for the popular GloVe model for distributed word representations, a.k.a. word vectors or embeddings
Apache License 2.0
6.86k stars 1.51k forks source link

Make: undefined reference to 'check_nan' #172

Closed fabero closed 1 year ago

fabero commented 4 years ago

I pulled the source code from the master branch and ran cd glove && make . However, this results in the following error. Does anyone know what the cause of this is? The version of release 1.2 does build, but it returns an error when running demo.sh , so I am kind of stuck here.


gcc -c src/vocab_count.c -o build/vocab_count.o -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc -c src/cooccur.c -o build/cooccur.o -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc -c src/shuffle.c -o build/shuffle.o -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc -c src/glove.c -o build/glove.o -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc -c src/common.c -o build/common.o -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc build/vocab_count.o build/common.o -o build/vocab_count -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc build/cooccur.o build/common.o -o build/cooccur -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc build/shuffle.o build/common.o -o build/shuffle -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
gcc build/glove.o build/common.o -o build/glove -lm -pthread -O3 -march=native -funroll-loops -Wall -Wextra -Wpedantic
build/glove.o:glove.c:function glove_thread: error: undefined reference to 'check_nan'
build/glove.o:glove.c:function glove_thread: error: undefined reference to 'check_nan'```
AngledLuffa commented 4 years ago

Could this be an issue with the compiler treating the function as an extern by default? In other words, you might be able to make progress by changing line 145 to

static inline real check_nan ...

I'm in no way a C compiler expert

masterccioli commented 1 year ago

This resolved the issue for me.