collect2: erro: ld retornou 1 status de saída Makefile: 107: receita do destino "binário" falhou make: *** [binário] Erro 1

0

Estou tentando compilar o ChatScript V7.55 no Ubuntu 16.04, mas recebi esta mensagem de erro:

collect2: error: ld returned 1 exit status
Makefile:107: recipe for target ‘binary’ failed
make: *** [binary] Error 1

O que é isso e como posso corrigir?

Este é o resultado completo depois de experimentar este comando: make server

************ LINUX VERSION ************
g++ constructCode.o duktape/duktape.c evserver.o csocket.o cs_ev.c dictionarySystem.o englishTagger.o factSystem.o json.o functionExecute.o english.o infer.o javascript.o jsmn.o markSystem.o mongodb.o os.o outputSystem.o patternSystem.o postgres.o privatesrc.o scriptCompile.o spellcheck.o secure.o systemVariables.o tagger.o testing.o textUtilities.o tokenSystem.o topicSystem.o userCache.o userSystem.o variableSystem.o mainSystem.o -L/usr/lib64 -lrt -lcurl  --verbose -pthread -DLOCKUSERFILE=1  -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1  -Ievserver -o ../BINARIES/ChatScript
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
COLLECT_GCC_OPTIONS='-L/usr/lib64' '-v' '-pthread' '-D' 'LOCKUSERFILE=1' '-D' 'EVSERVER=1' '-D' 'EVSERVER_FORK=1' '-D' 'DISCARDPOSTGRES=1' '-D' 'DISCARDMONGO=1' '-D' 'DISCARDMYSQL=1' '-I' 'evserver' '-o' '../BINARIES/ChatScript' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -I evserver -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D_REENTRANT -D LOCKUSERFILE=1 -D EVSERVER=1 -D EVSERVER_FORK=1 -D DISCARDPOSTGRES=1 -D DISCARDMONGO=1 -D DISCARDMYSQL=1 duktape/duktape.c -quiet -dumpbase duktape.c -mtune=generic -march=x86-64 -auxbase duktape -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccz9862e.s
GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 evserver
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c3fdb80f2154421ceaf9e22c85325a8d
COLLECT_GCC_OPTIONS='-L/usr/lib64' '-v' '-pthread' '-D' 'LOCKUSERFILE=1' '-D' 'EVSERVER=1' '-D' 'EVSERVER_FORK=1' '-D' 'DISCARDPOSTGRES=1' '-D' 'DISCARDMONGO=1' '-D' 'DISCARDMYSQL=1' '-I' 'evserver' '-o' '../BINARIES/ChatScript' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v -I evserver --64 -o /tmp/ccm8SVai.o /tmp/ccz9862e.s
GNU assembler version 2.26.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1
COLLECT_GCC_OPTIONS='-L/usr/lib64' '-v' '-pthread' '-D' 'LOCKUSERFILE=1' '-D' 'EVSERVER=1' '-D' 'EVSERVER_FORK=1' '-D' 'DISCARDPOSTGRES=1' '-D' 'DISCARDMONGO=1' '-D' 'DISCARDMYSQL=1' '-I' 'evserver' '-o' '../BINARIES/ChatScript' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -quiet -v -I evserver -imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D_REENTRANT -D LOCKUSERFILE=1 -D EVSERVER=1 -D EVSERVER_FORK=1 -D DISCARDPOSTGRES=1 -D DISCARDMONGO=1 -D DISCARDMYSQL=1 cs_ev.c -quiet -dumpbase cs_ev.c -mtune=generic -march=x86-64 -auxbase cs_ev -version -fstack-protector-strong -Wformat -Wformat-security -o /tmp/ccz9862e.s
GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 evserver
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) version 5.4.0 20160609 (x86_64-linux-gnu)
    compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c3fdb80f2154421ceaf9e22c85325a8d
In file included from cs_ev.c:5:0:
evserver/ev.c:1254:31: warning: ‘ev_default_loop_ptr’ initialized and declared ‘extern’
   EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
                               ^
COLLECT_GCC_OPTIONS='-L/usr/lib64' '-v' '-pthread' '-D' 'LOCKUSERFILE=1' '-D' 'EVSERVER=1' '-D' 'EVSERVER_FORK=1' '-D' 'DISCARDPOSTGRES=1' '-D' 'DISCARDMONGO=1' '-D' 'DISCARDMYSQL=1' '-I' 'evserver' '-o' '../BINARIES/ChatScript' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as -v -I evserver --64 -o /tmp/ccRZyE1l.o /tmp/ccz9862e.s
GNU assembler version 2.26.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-L/usr/lib64' '-v' '-pthread' '-D' 'LOCKUSERFILE=1' '-D' 'EVSERVER=1' '-D' 'EVSERVER_FORK=1' '-D' 'DISCARDPOSTGRES=1' '-D' 'DISCARDMONGO=1' '-D' 'DISCARDMYSQL=1' '-I' 'evserver' '-o' '../BINARIES/ChatScript' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIwnEUp.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o ../BINARIES/ChatScript /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. constructCode.o /tmp/ccm8SVai.o evserver.o csocket.o /tmp/ccRZyE1l.o dictionarySystem.o englishTagger.o factSystem.o json.o functionExecute.o english.o infer.o javascript.o jsmn.o markSystem.o mongodb.o os.o outputSystem.o patternSystem.o postgres.o privatesrc.o scriptCompile.o spellcheck.o secure.o systemVariables.o tagger.o testing.o textUtilities.o tokenSystem.o topicSystem.o userCache.o userSystem.o variableSystem.o mainSystem.o -lrt -lcurl -lstdc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function '_start':
(.text+0x20): undefined reference to 'main'
evserver.o: In function 'evsrv_do_chat(Client_t*)':
evserver.cpp:(.text+0x161a): undefined reference to 'LogChat(long, char*, char*, char*, int, char*, char*)'
mainSystem.o: In function 'InitSystem(int, char**, char*, char*, char*, USERFILESYSTEM*, void (*)(char*), void (*)(char*))':
mainSystem.cpp:(.text+0x2687): undefined reference to 'ReadTopicFiles(char*, unsigned int, int)'
mainSystem.cpp:(.text+0x273d): undefined reference to 'ReadTopicFiles(char*, unsigned int, int)'
collect2: error: ld returned 1 exit status
Makefile:107: recipe for target 'binary' failed
make: *** [binary] Error 1

Este é o conteúdo make file também:

.PHONY = all clean binary server debugserver standalone pgserver debugpgserver mongoserver debugmongoserver foreignserver mongotreetaggerserver 


server: DEFINES+= -DLOCKUSERFILE=1  -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1 
server: PGLOAD= -pthread
server: INCLUDEDIRS=-Ievserver
server: all
server: EXECUTABLE=../BINARIES/ChatScript
server: CFLAGS=-c  -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing 

debugserver: DEFINES+= -DLOCKUSERFILE=1 -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1  -DDEBUG -DEVSERVER=1 -DEVSERVER_FORK=1 
debugserver: PGLOAD= -pthread
debugserver: INCLUDEDIRS=-Ievserver
debugserver: all
debugserver: EXECUTABLE=../BINARIES/ChatScriptDebug
debugserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing -g

standalone: DEFINES+=  -DDISCARDSERVER=1 -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1 -DEVSERVER=1 -DEVSERVER_FORK=1
standalone: PGLOAD= -pthread
standalone: INCLUDEDIRS=-Ievserver
standalone: all
standalone: EXECUTABLE=../BINARIES/ChatScript
standalone: CFLAGS=-c -std=c++11  -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing 

pgserver: DEFINES+= -DLOCKUSERFILE=1 -DEVSERVER=1 -DEVSERVER_FORK=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1
pgserver: PGLOAD= -lpq -pthread
pgserver: all
pgserver: EXECUTABLE=../BINARIES/ChatScriptpg
pgserver: INCLUDEDIRS=-Ievserver -Ipostgres
pgserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing 

debugpgserver: DEFINES+= -DLOCKUSERFILE=1  -DDEBUG -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDMONGO=1  
debugpgserver: PGLOAD= -lpq -pthread
debugpgserver: INCLUDEDIRS=-Ievserver
debugpgserver: all
debugpgserver: EXECUTABLE=../BINARIES/ChatScriptpgDebug
debugpgserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing -g

mongoserver: DEFINES+= -DLOCKUSERFILE=1 -DEVSERVER=1 -DEVSERVER_FORK=1 -DDISCARDPOSTGRES=1 -DDISCARDMYSQL=1
mongoserver: PGLOAD= -pthread
mongoserver: all
mongoserver: EXECUTABLE=../BINARIES/ChatScriptMongo
mongoserver: INCLUDEDIRS=-Iinclude -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0
mongoserver: CFLAGS=-c -std=c++11  -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing -g

debugmongoserver: DEFINES+= -DLOCKUSERFILE=1  -DDEBUG -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDPOSTGRES=1  -DDISCARDMYSQL=1
debugmongoserver: PGLOAD= -lpq -pthread
debugmongoserver: all
debugmongoserver: INCLUDEDIRS=-Iinclude -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0
debugmongoserver: EXECUTABLE=../BINARIES/ChatScriptMongoDebug
debugmongoserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing -g

foreignserver: DEFINES+= -DLOCKUSERFILE=1  -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDPOSTGRES=1 -DDISCARDMONGO=1 -DDISCARDMYSQL=1 -DTREETAGGER=1
foreignserver: PGLOAD= -pthread -L../treetagger -L../BINARIES -ltreetagger
foreignserver: INCLUDEDIRS=-Ievserver
foreignserver: all
foreignserver: EXECUTABLE=../BINARIES/ChatScriptForeign
foreignserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing 

mongotreetaggerserver: DEFINES+= -DLOCKUSERFILE=1  -DEVSERVER=1 -DEVSERVER_FORK=1  -DDISCARDPOSTGRES=1  -DDISCARDMYSQL=1 -DTREETAGGER=1
mongotreetaggerserver: PGLOAD= -pthread -L../treetagger -L../BINARIES -ltreetagger
mongotreetaggerserver: INCLUDEDIRS=-Iinclude -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0
mongotreetaggerserver: all
mongotreetaggerserver: EXECUTABLE=../BINARIES/ChatScriptMongoForeign
mongotreetaggerserver: CFLAGS=-c -std=c++11 -Wall  -funsigned-char  -Wno-write-strings -Wno-char-subscripts -Wno-strict-aliasing 

UNAME := $(shell uname)

CC=g++

ifeq ($(UNAME), Linux)
$(info ************ LINUX VERSION ************)
LDFLAGS= -L/usr/lib64 -lrt -lcurl  --verbose $(PGLOAD)
mongoserver: LDFLAGS+= -lcrypt -lsasl2 -L/usr/local/lib -lmongoc-1.0 -lbson-1.0 
debugmongoserver: LDFLAGS+= -lcrypt -lsasl2 -L/usr/local/lib -lmongoc-1.0 -lbson-1.0 
mongotreetaggerserver: LDFLAGS+= -lcrypt -lsasl2 -L/usr/local/lib -lmongoc-1.0 -lbson-1.0 
endif

ifeq ($(UNAME), Darwin)
OSXRELEASE := $(shell defaults read loginwindow SystemVersionStampAsString)
$(info ************ MAC VERSION $OSXRELEASE detected ************)
LDFLAGS=-mmacosx-version-min=$(OSXRELEASE) -lcurl $(PGLOAD)  
CFLAGS=-mmacosx-version-min=$(OSXRELEASE) -c  -Wall  -funsigned-char -Wno-write-strings -Wno-char-subscripts 
endif

ifeq ($(UNAME), FreeBSD)
$(info ************ FREEBSD VERSION ************)
DEFINES+= -DFREEBSD=1
INCLUDEDIRS+= -I/usr/local/include
LDFLAGS= -L/usr/local/lib -lrt -lcurl -lev  --verbose $(PGLOAD)
mongoserver: LDFLAGS+= -lgcrypt -lsasl2 -lmongoc-1.0 -lbson-1.0 
debugmongoserver: LDFLAGS+= -lgcrypt -lsasl2 -lmongoc-1.0 -lbson-1.0 
mongotreetaggerserver: LDFLAGS+= -lgcrypt -lsasl2 -lmongoc-1.0 -lbson-1.0 
endif

SOURCES=constructCode.cpp duktape/duktape.c evserver.cpp csocket.cpp cs_ev.c dictionarySystem.cpp englishTagger.cpp factSystem.cpp json.cpp functionExecute.cpp english.cpp infer.cpp javascript.cpp jsmn.cpp markSystem.cpp mongodb.cpp os.cpp outputSystem.cpp patternSystem.cpp postgres.cpp privatesrc.cpp scriptCompile.cpp spellcheck.cpp secure.cpp systemVariables.cpp tagger.cpp testing.cpp textUtilities.cpp tokenSystem.cpp topicSystem.cpp userCache.cpp userSystem.cpp variableSystem.cpp mainSystem.cpp 
OBJECTS=$(SOURCES:.cpp=.o)

all: $(SOURCES) binary

clean:
    -rm -f $(EXECUTABLE)
    -rm -f ../$(EXECUTABLE)
    -rm -f *.o

binary: $(OBJECTS)
    $(CC) $(OBJECTS) $(LDFLAGS) $(DEFINES) $(INCLUDEDIRS) -o $(EXECUTABLE)

.cpp.o:
    $(CC) $(CFLAGS) $(DEFINES) $(INCLUDEDIRS) $< -o $@
    
por Hasani 07.10.2017 / 21:38

0 respostas