This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm going to use webdis but get and error on linking stage. Webdis is a web face for redis database. You can find it here: http://webd.is .
My system configuration is:
* Ubuntu Oneiric Ocelot (11.10 Alpha)
* Gcc 4.6
* Linux kernel 3.0.0-7
When I do make I get the next output:
krolik#krolik-PC:~/Projects/webdis$ make
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o webdis.o webdis.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o cmd.o cmd.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o worker.o worker.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o slog.o slog.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o server.o server.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o libb64/cencode.o libb64/cencode.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o acl.o acl.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o md5/md5.o md5/md5.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http.o http.c
http.c: In function ‘http_response_write’:
http.c:138:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o client.o client.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o websocket.o websocket.c
websocket.c: In function ‘ws_handshake_reply’:
websocket.c:76:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o pool.o pool.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o conf.o conf.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/json.o formats/json.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/raw.o formats/raw.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/common.o formats/common.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/custom-type.o formats/custom-type.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/bson.o formats/bson.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/hiredis.o hiredis/hiredis.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/sds.o hiredis/sds.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/net.o hiredis/net.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/async.o hiredis/async.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/dict.o hiredis/dict.c
hiredis/dict.c:53:21: warning: ‘dictGenHashFunction’ defined but not used [-Wunused-function]
hiredis/dict.c:73:14: warning: ‘dictCreate’ defined but not used [-Wunused-function]
hiredis/dict.c:160:12: warning: ‘dictReplace’ defined but not used [-Wunused-function]
hiredis/dict.c:182:12: warning: ‘dictDelete’ defined but not used [-Wunused-function]
hiredis/dict.c:238:13: warning: ‘dictRelease’ defined but not used [-Wunused-function]
hiredis/dict.c:258:22: warning: ‘dictGetIterator’ defined but not used [-Wunused-function]
hiredis/dict.c:268:19: warning: ‘dictNext’ defined but not used [-Wunused-function]
hiredis/dict.c:288:13: warning: ‘dictReleaseIterator’ defined but not used [-Wunused-function]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/dump.o jansson/src/dump.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/error.o jansson/src/error.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/hashtable.o jansson/src/hashtable.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/load.o jansson/src/load.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/strbuffer.o jansson/src/strbuffer.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/utf.o jansson/src/utf.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/value.o jansson/src/value.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/variadic.o jansson/src/variadic.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http-parser/http_parser.o http-parser/http_parser.c
cc -levent -pthread -o webdis webdis.o cmd.o worker.o slog.o server.o libb64/cencode.o acl.o md5/md5.o http.o client.o websocket.o pool.o conf.o formats/json.o formats/raw.o formats/common.o formats/custom-type.o formats/bson.o hiredis/hiredis.o hiredis/sds.o hiredis/net.o hiredis/async.o hiredis/dict.o jansson/src/dump.o jansson/src/error.o jansson/src/hashtable.o jansson/src/load.o jansson/src/strbuffer.o jansson/src/utf.o jansson/src/value.o jansson/src/variadic.o http-parser/http_parser.o
worker.o: In function `worker_main':
worker.c:(.text+0xd): undefined reference to `event_base_new'
worker.c:(.text+0x29): undefined reference to `event_set'
worker.c:(.text+0x35): undefined reference to `event_base_set'
worker.c:(.text+0x3f): undefined reference to `event_add'
worker.c:(.text+0x6b): undefined reference to `event_base_dispatch'
worker.o: In function `worker_can_read':
worker.c:(.text+0xd2): undefined reference to `event_set'
worker.c:(.text+0xe5): undefined reference to `event_base_set'
worker.o: In function `worker_on_new_client':
worker.c:(.text+0x1f5): undefined reference to `event_set'
worker.c:(.text+0x208): undefined reference to `event_base_set'
worker.c:(.text+0x212): undefined reference to `event_add'
worker.o: In function `worker_monitor_input':
worker.c:(.text+0x2b8): undefined reference to `event_set'
worker.c:(.text+0x2cb): undefined reference to `event_base_set'
worker.o: In function `worker_can_read':
worker.c:(.text+0xf5): undefined reference to `event_add'
worker.o: In function `worker_monitor_input':
worker.c:(.text+0x2e3): undefined reference to `event_add'
server.o: In function `server_start':
server.c:(.text+0x217): undefined reference to `event_reinit'
server.c:(.text+0x338): undefined reference to `event_base_new'
server.c:(.text+0x35a): undefined reference to `event_set'
server.c:(.text+0x369): undefined reference to `event_base_set'
server.c:(.text+0x373): undefined reference to `event_add'
server.c:(.text+0x37f): undefined reference to `event_base_dispatch'
http.o: In function `http_can_write':
http.c:(.text+0x63): undefined reference to `event_set'
http.c:(.text+0x76): undefined reference to `event_base_set'
http.o: In function `http_schedule_write':
http.c:(.text+0x3f1): undefined reference to `event_set'
http.c:(.text+0x404): undefined reference to `event_base_set'
http.o: In function `http_response_write':
http.c:(.text+0x6b1): undefined reference to `event_set'
http.c:(.text+0x6c4): undefined reference to `event_base_set'
http.c:(.text+0x6ce): undefined reference to `event_add'
http.o: In function `http_response_write_chunk':
http.c:(.text+0xc36): undefined reference to `event_set'
http.c:(.text+0xc49): undefined reference to `event_base_set'
http.c:(.text+0xc53): undefined reference to `event_add'
http.o: In function `http_can_write':
http.c:(.text+0x84): undefined reference to `event_add'
http.o: In function `http_schedule_write':
http.c:(.text+0x40f): undefined reference to `event_add'
pool.o: In function `redisLibeventCleanup':
pool.c:(.text+0x89): undefined reference to `event_del'
pool.c:(.text+0x95): undefined reference to `event_del'
pool.o: In function `pool_on_disconnect':
pool.c:(.text+0x179): undefined reference to `event_set'
pool.c:(.text+0x189): undefined reference to `event_base_set'
pool.o: In function `redisLibeventAttach':
pool.c:(.text+0x266): undefined reference to `event_set'
pool.c:(.text+0x281): undefined reference to `event_set'
pool.c:(.text+0x28c): undefined reference to `event_base_set'
pool.c:(.text+0x297): undefined reference to `event_base_set'
pool.o: In function `pool_can_connect':
pool.c:(.text+0x3dd): undefined reference to `event_set'
pool.c:(.text+0x3ed): undefined reference to `event_base_set'
pool.o: In function `pool_connect':
pool.c:(.text+0x595): undefined reference to `event_set'
pool.c:(.text+0x5a5): undefined reference to `event_base_set'
pool.c:(.text+0x5b6): undefined reference to `event_add'
pool.o: In function `redisLibeventAddWrite':
pool.c:(.text+0x6a): undefined reference to `event_add'
pool.o: In function `redisLibeventAddRead':
pool.c:(.text+0x77): undefined reference to `event_add'
pool.o: In function `redisLibeventDelWrite':
pool.c:(.text+0xb8): undefined reference to `event_del'
pool.o: In function `redisLibeventDelRead':
pool.c:(.text+0xc5): undefined reference to `event_del'
pool.o: In function `pool_on_disconnect':
pool.c:(.text+0x19e): undefined reference to `event_add'
pool.o: In function `pool_can_connect':
pool.c:(.text+0x402): undefined reference to `event_add'
collect2: ld returned 1 exit status
make: *** [webdis] Помилка 1
I have libevent.so and libevent-dev headers installed in my /usr/lib directory and I also tried -levent2 instead of -levent in LDFLAGS variable of Makefile but still didn't got any progress. What can be the solution for my issue?
Thank you.
You need to put the -levent command line option after the names of the object files in the linker command line. From the GCC documentation on the -l flag:
-llibrary
-l library
Search the library named library when linking. (The second
alternative with the library as a separate argument is only for
POSIX compliance and is not recommended.)
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in
z, those functions may not be loaded.
Related
I am trying to compile a code by Makefile. I received the code from github. I tried to implement the solution from links:
[https://github.com/LLNL/scr/issues/130][1]
[https://stackoverflow.com/questions/62461718/mpi-complile-error-undefined-reference-to-mpiwinfree][2], etc.
These solutions are not working for me or they are too technical. I am sorry to say as I am not from a programming background, it is difficult for me to understand.
The make file are as follows:
Makefile.include
.SUFFIXES: .cxx .cu .f90 .o
.PHONY: docs
CUDA_INSTALL_PATH = /usr/local/cuda
DEVICE = cpu
#~ DEVICE = gpu
CXX = mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include
NVCC = nvcc -Xcompiler "-fopenmp -O3" -std=c++11 -use_fast_math -I../include
FC = mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
LFLAGS = -D$(DEVICE) -lstdc++ -ldl -lm
#~ LFLAGS += -lmpi_cxx
ifeq ($(DEVICE),gpu)
LFLAGS += -lcudart
endif
OBJECT = ../kernel/$(DEVICE)Laplace.o ../kernel/$(DEVICE)BiotSavart.o\
../kernel/$(DEVICE)Stretching.o ../kernel/$(DEVICE)Gaussian.o\
../kernel/$(DEVICE)CoulombVdW.o
.cxx.o:
$(CXX) -c $? -o $# $(LFLAGS)
.cu.o:
$(NVCC) -c $? -o $# $(LFLAGS)
.f90.o:
$(FC) -c $? -o $#
and Makefile:
include ../Makefile.include
lib_parallel_ij: parallel_wrapper_ij.o $(OBJECT)
ar -cr libfmm.a parallel_wrapper_ij.o $(OBJECT)
ranlib libfmm.a
test_parallel_ij: test_parallel_ij.o
make lib_parallel_ij
$(FC) $? -L. -lfmm $(LFLAGS)
mpirun -np 2 ./a.out
clean:
make -C .. clean
When I am trying to compile it. It gives me the following errors:
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include -c test_parallel_ij.f90 -o test_parallel_ij.o
make lib_parallel_ij
make[1]: Entering directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c parallel_wrapper_ij.cxx -o parallel_wrapper_ij.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuLaplace.cxx -o ../kernel/cpuLaplace.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuBiotSavart.cxx -o ../kernel/cpuBiotSavart.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuStretching.cxx -o ../kernel/cpuStretching.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuGaussian.cxx -o ../kernel/cpuGaussian.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuCoulombVdW.cxx -o ../kernel/cpuCoulombVdW.o -Dcpu -lstdc++ -ldl -lm
ar -cr libfmm.a parallel_wrapper_ij.o ../kernel/cpuLaplace.o ../kernel/cpuBiotSavart.o ../kernel/cpuStretching.o ../kernel/cpuGaussian.o ../kernel/cpuCoulombVdW.o
ranlib libfmm.a
make[1]: Leaving directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include test_parallel_ij.o -L. -lfmm -Dcpu -lstdc++ -ldl -lm
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/op_inln.h:121: undefined reference to `ompi_mpi_cxx_op_intercept'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Graphcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Sub(bool const*) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o):/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: more undefined references to `MPI::Comm::Comm()' follow
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'test_parallel_ij' failed
make: *** [test_parallel_ij] Error 1
I am unable to solve the error. I couldn't compile the code. I will be greatly helped if I can get some clue to compile it.
Thanks a lot.
[1]: https://github.com/LLNL/scr/issues/130
[2]: MPI complile error, undefined reference to `MPI::Win::Free()
Trying to build SDL2-2.0.14 on Windows with latest MSYS.
If i try to build with the minimal makefile in the root SDL directory i get the following error:
cc -g -O2 -I./include -c -o src/timer/dummy/SDL_systimer.o src/timer/dummy/SDL_systimer.c
cc -g -O2 -I./include -c -o src/video/SDL_RLEaccel.o src/video/SDL_RLEaccel.c
cc -g -O2 -I./include -c -o src/video/SDL_blit.o src/video/SDL_blit.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_0.o src/video/SDL_blit_0.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_1.o src/video/SDL_blit_1.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_A.o src/video/SDL_blit_A.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_N.o src/video/SDL_blit_N.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_auto.o src/video/SDL_blit_auto.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_copy.o src/video/SDL_blit_copy.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_slow.o src/video/SDL_blit_slow.c
cc -g -O2 -I./include -c -o src/video/SDL_bmp.o src/video/SDL_bmp.c
cc -g -O2 -I./include -c -o src/video/SDL_clipboard.o src/video/SDL_clipboard.c
cc -g -O2 -I./include -c -o src/video/SDL_egl.o src/video/SDL_egl.c
src/video/SDL_egl.c:25:2: error: #error this should be not defined
25 | #error this should be not defined
| ^~~~~
In file included from src/video/SDL_egl_c.h:28,
from src/video/SDL_egl.c:36:
./include/SDL_egl.h:29:10: fatal error: EGL/egl.h: No such file or directory
29 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/video/SDL_egl.o] Error 1
Solved it removing OPENGL support in include/SDL_config_windows.h:269:
#ifndef SDL_VIDEO_OPENGL_EGL
/* #define SDL_VIDEO_OPENGL_EGL 1 commented for wind64 build */
#endif
Now i've got the libSDL.a file, but if i try to build a test from the test folder:
Alessandro#DESKTOP-954PK5R MINGW64 /c/WORK/sdl_latest/SDL2-2.0.14/test
$ cc -g testkeys.c ../libSDL.a -I../include -o testkeys.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccSosm3W.o: in function `SDL_main':
C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:28: undefined reference to `SDL_LogSetPriority'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:30: undefined reference to `SDL_Init'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:31: undefined reference to `SDL_GetError'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:31: undefined reference to `SDL_LogError'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:35: undefined reference to `SDL_GetScancodeName'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:35: undefined reference to `SDL_Log'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:38: undefined reference to `SDL_Quit'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Do i have to link something else?
This question already has an answer here:
g++ undefined reference to `boost::system::system_category()'
(1 answer)
Closed 9 years ago.
I have a problem with my code.
I have such an info trying to build:
g++ -L /usr/local/boost_1_55_0 -Wall -pedantic -Iinc -c -lboost_system -pthread -lboost_thread -o obj/glo.o src/glo.cpp
g++ -L /usr/local/boost_1_55_0 -Wall -pedantic -Iinc -c -lboost_system -pthread -lboost_thread -o obj/serial.o src/serial.cpp
g++ -I /usr/local/boost_1_55_0 -Wall -lboost_system -pthread -o dwa obj/glo.o obj/serial.o
obj/glo.o: In function `__static_initialization_and_destruction_0(int, int)':
glo.cpp:(.text+0x15a): undefined reference to `boost::system::generic_category()'
glo.cpp:(.text+0x166): undefined reference to `boost::system::generic_category()'
glo.cpp:(.text+0x172): undefined reference to `boost::system::system_category()'
obj/glo.o: In function `boost::system::error_code::error_code()':
glo.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'
and similar.
As You can see I have given
-lboost_system -pthread -lboost_thread and compiled system boost in /usr/local/boost_1_55_0
I have no idea whats happening.
Absolutely, g++ cannot find library boost_system. It should locate in /usr/local/boost_1_55_0/lib. You can add option "-v" to check the detailed error messages.
g++ -v -L/usr/local/boost_1_55_0/lib -Wall -lboost_system -pthread -o dwa obj/glo.o obj/serial.o
The commands should be as following:
g++ -I/usr/local/boost_1_55_0/include -Wall -pedantic -Iinc -c -o obj/glo.o src/glo.cpp
g++ -I/usr/local/boost_1_55_0/include -Wall -pedantic -Iinc -c -o obj/serial.o src/serial.cpp
g++ -L/usr/local/boost_1_55_0/lib -Wall -lboost_system -pthread -o dwa obj/glo.o obj/serial.o
I have tried to build the stmd library (http://getassoc.cs.nii.ac.jp/package/stmd-1.1.5.tar.gz) on Ubuntu 12.04.2 amd64 which use the ICU library.
I have installed libicu-dev (version: 48) from Ubuntu repository and using the following configuration.
./configure --with-icu-config=/usr/bin/icu-config --with-defaultstemmer=SNOWBALL --enable-snowball=yes --enable-kill3number=yes
and then,
make
I got the following errors..
/bin/bash ./libtool --mode=link g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after- statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 '-DDEFAULT_STEMMER=SNOWBALL' '-DSTMD_MYSTEMMER_DIR="/usr/local/bin"' -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include '-DUSE_SNOWBALL=1' -I/usr/local/include -DKILL3NUMBER=1 -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -o stmd stmd.o stmc.o sigflg.o nio.o -L. -L/usr/lib -ldl -lm -L/usr/lib -licui18n -licuuc -licudata -ldl -lm -L/usr/local/lib -lystem -lstemmer -lexpat -ldl
libtool: link: g++ -I. -g -O2 -Wall -Wno-parentheses -Wdeclaration-after-statement -g -O -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -DDEFAULT_STEMMER=SNOWBALL -DSTMD_MYSTEMMER_DIR=\"/usr/local/bin\" -g -Wall -O2 -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -D_REENTRANT -I/usr/include -DUSE_SNOWBALL=1 -I/usr/local/include -DKILL3NUMBER=1 -o stmd stmd.o stmc.o sigflg.o nio.o -L/usr/lib -L/usr/local/lib -L/home/kobkrit/stmd-1.1.5 -licui18n -licuuc -licudata -lm -lystem -lstemmer /usr/lib/x86_64-linux-gnu/libexpat.so -ldl
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf8toutf16':
/home/kobkrit/stmd-1.1.5/normalizer.c:177: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:191: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `utf16toutf8':
/home/kobkrit/stmd-1.1.5/normalizer.c:227: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:219: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:223: undefined reference to `utf8_appendCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(normalizer.o): In function `normalizer_sparse_tostr':
/home/kobkrit/stmd-1.1.5/normalizer.c:125: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:138: undefined reference to `unorm_normalize_48'
/home/kobkrit/stmd-1.1.5/normalizer.c:140: undefined reference to `u_errorName_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `nextchar':
/home/kobkrit/stmd-1.1.5/ngram.c:158: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/ngram.c:150: undefined reference to `utf8_nextCharSafeBody_48'
/home/kobkrit/stmd-1.1.5/libystem.a(ngram.o): In function `ng_output':
/home/kobkrit/stmd-1.1.5/ngram.c:182: undefined reference to `utf8_appendCharSafeBody_48'
collect2: ld returned 1 exit status
make: *** [stmd] Error 1
It seems about the problem between linker to ICU library, so I take a look on Makefile, I found
...
CFLAGS+=$(shell /usr/bin/icu-config --cflags)
CFLAGS+=$(shell /usr/bin/icu-config --cppflags)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags-searchpath)
LDFLAGS+=$(shell /usr/bin/icu-config --ldflags)
...
(I don't quite sure, does it relate to the problem or not?)
I tried build the stmd library on Ubuntu 10.04.4 LTS amd64 and it went fine and work perfectly. But sadly my server's hardware is not compatible with the old Ubuntu. Please help.
Your command line:
g++ ... -licui18n -licuuc -licudata -ldl -lm ... -o stmd stmd.o stmc.o ...
is incorrect: the order of object files and libraries on command line matters.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I tried to compile Shallot on Ubuntu linux (gcc ./src/shallot.c), but I've got this error:
/tmp/ccwsRxaV.o: In function `main':
shallot.c:(.text+0x3d): undefined reference to `usage'
shallot.c:(.text+0x1ea): undefined reference to `parse_cpuinfo'
shallot.c:(.text+0x2a3): undefined reference to `pattern'
shallot.c:(.text+0x2eb): undefined reference to `usage'
shallot.c:(.text+0x3ba): undefined reference to `usage'
shallot.c:(.text+0x440): undefined reference to `usage'
shallot.c:(.text+0x4de): undefined reference to `usage'
shallot.c:(.text+0x57a): undefined reference to `usage'
/tmp/ccwsRxaV.o:shallot.c:(.text+0x5f4): more undefined references to `usage' follow
/tmp/ccwsRxaV.o: In function `main':
shallot.c:(.text+0x92d): undefined reference to `worker'
shallot.c:(.text+0x941): undefined reference to `pthread_create'
shallot.c:(.text+0x984): undefined reference to `monitor_proc'
shallot.c:(.text+0x998): undefined reference to `pthread_create'
shallot.c:(.text+0x9b7): undefined reference to `worker'
shallot.c:(.text+0x9db): undefined reference to `pthread_join'
Sorry, but I'm not a programmer. I don't really know how this should work.
Well I went to the site, took down the instructions and gave it a try. Seems pretty straight forward:
First clone the source into a "shallot" directory:
git clone https://github.com/katmagic/Shallot.git Shallot
Then we run the configure:
mike#linux-4puc:~/C/Shallot> ./configure Liunx detected. Have you
considered switching to BSD? Configuration successful. This does not
mean it will build. If you are missing gcc, or required
libraries/headers, you will need to install them first.
Finally run the Makefile:
mike#linux-4puc:~/C/Shallot> make
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/math.o -c src/math.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/error.o -c src/error.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/linux.o -c src/linux.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/print.o -c src/print.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/thread.o -c src/thread.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -Wall -o src/shallot.o -c src/shallot.c
cc -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -pthread src/math.o src/error.o src/linux.o src/print.o src/thread.o src/shallot.o -o shallot -lm -lpthread -lssl -lcrypto
And now the executable shallot can be seen in the directory:
mike#linux-4puc:~/C/Shallot> ls
CHANGELOG configure LICENSE Makefile README.asciidoc shallot src
So if you followed all the steps exactly like I did, I suspect the place you're having issues is the block of text I highlighted above. Do you have all the required libraries/headers for building shallot?