yandex / faster-rnnlm

Faster Recurrent Neural Network Language Modeling Toolkit with Noise Contrastive Estimation and Hierarchical Softmax
Other
562 stars 138 forks source link

OSX compilation error; ld: library not found for -lrt #5

Closed scottlingran closed 9 years ago

scottlingran commented 9 years ago

This occurs from running make -j

g++ rnnlm.o hierarchical_softmax.o nce.o words.o maxent.o nnet.o recurrent.o -o rnnlm -Wall -march=native -funroll-loops -g -D__STDC_FORMAT_MACROS -I../ -DEIGEN_DONT_PARALLELIZE  -O3 -pthread -DNOCUDA -lm -lrt
clang: warning: argument unused during compilation: '-pthread'
ld: library not found for -lrt

If -lrt is removed, this error occurs:

Undefined symbols for architecture x86_64:
  "Vocabulary::HashImpl::kMinSize", referenced from:
      Vocabulary::HashImpl::Rebuild() in words.o
  "Vocabulary::kWordOOV", referenced from:
      Vocabulary::HashImpl::Rebuild() in words.o
ld: symbol(s) not found for architecture x86_64
akhti commented 9 years ago

Try d3c9204d1512c636f69566bbc9466b27325f08d8

scottlingran commented 9 years ago

Wooooo, it works! Thanks Anton :)

HLin00 commented 7 years ago

I have a similar issue when I compile my makefile:

***

JustGarble

***

SRCDIR = src OBJDIR = obj BINDIR = bin TESTDIR = test OBJECTFULL = obj/*.o

SOURCES := $(wildcard $(SRCDIR)/.c) INCLUDES := $(wildcard $(SRCDIR)/.h) OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

IDIR =../include CC=gcc

CFLAGS= -O3 -lm -lrt -lpthread -maes -msse4 -lmsgpackc -lssl -lcrypto -march=native -I$(IDIR) CFLAGS += $(shell $(CC) -dumpversion | awk '{if(NR==1 && $$1>="4.6") print "-Ofast -Wno-unused-result"; else print "-O3";}') UNAME := $(shell uname) ifeq ($(UNAME), Darwin) CFLAGS += -DNORT else LDFLAGS += -lrt endif

GWAS = MultyPartyGWASTest GWAS2 = SpeedTestSmallerRealSumLinTest GWAS3 = PartSmallerRealSumLinTest GWAS4 = MultyPartySumLinTest rm = rm --f

all: GWAS GWAS2 GWAS3 GWAS4

GWAS: $(OBJECTS) $(TESTDIR)/$(GWAS).c $(CC) $(OBJECTFULL) $(TESTDIR)/$(GWAS).c -o $(BINDIR)/$(GWAS).out $(LIBS) $(CFLAGS)

GWAS2: $(OBJECTS) $(TESTDIR)/$(GWAS2).c $(CC) $(OBJECTFULL) $(TESTDIR)/$(GWAS2).c -o $(BINDIR)/$(GWAS2).out $(LIBS) $(CFLAGS)

GWAS3: $(OBJECTS) $(TESTDIR)/$(GWAS3).c $(CC) $(OBJECTFULL) $(TESTDIR)/$(GWAS3).c -o $(BINDIR)/$(GWAS3).out $(LIBS) $(CFLAGS)

GWAS4: $(OBJECTS) $(TESTDIR)/$(GWAS4).c $(CC) $(OBJECTFULL) $(TESTDIR)/$(GWAS4).c -o $(BINDIR)/$(GWAS4).out $(LIBS) $(CFLAGS)

$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(CC) -c $< -o $@ $(LIBS) $(CFLAGS)

.PHONEY: clean clean: @$(rm) $(OBJECTS) @$(rm) $(BINDIR)/$(AES) @$(rm) $(BINDIR)/$(LARGE) @$(rm) $(BINDIR)/$(FILE)

If I run make all, I will get error like: ld: library not found for -lrt clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [GWAS2] Error 1

If I remove -lrt from CFLAGS, I will get errors like:

Undefined symbols for architecture x86_64: "_ADDCircuit", referenced from: _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _sum in SpeedTestSmallerRealSumLinTest-69ed37.o "_ANDGate", referenced from: _muxInt in SpeedTestSmallerRealSumLinTest-69ed37.o _mux in SpeedTestSmallerRealSumLinTest-69ed37.o _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _sumLinGWAS in SpeedTestSmallerRealSumLinTest-69ed37.o "_NOTGate", referenced from: _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_XORCircuit", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_XORGate", referenced from: _muxInt in SpeedTestSmallerRealSumLinTest-69ed37.o _mux in SpeedTestSmallerRealSumLinTest-69ed37.o _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _sumLinGWAS in SpeedTestSmallerRealSumLinTest-69ed37.o "_countToN", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_createEmptyGarbledCircuit", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_createInputLabels", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_evaluate", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_extractLabels", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_finishBuilding", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_fixedOneWire", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_fixedZeroWire", referenced from: _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_garbleCircuit", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_getNextWire", referenced from: _muxInt in SpeedTestSmallerRealSumLinTest-69ed37.o _mux in SpeedTestSmallerRealSumLinTest-69ed37.o _mul in SpeedTestSmallerRealSumLinTest-69ed37.o _sumLinGWAS in SpeedTestSmallerRealSumLinTest-69ed37.o _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_mapOutputs", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_readCircuitFromFile", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_startBuilding", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o "_writeCircuitToFile", referenced from: _garbleTest in SpeedTestSmallerRealSumLinTest-69ed37.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [GWAS2] Error 1

HLin00 commented 7 years ago

What should I do?

rversteegen commented 7 years ago

That Makefile shares a few lines in common with the faster-rnnlm one, but other than that your problem has nothing to do with this project. None of those symbols exist in the faster-rnnlm source.