compat_libevent.c undefined对`event_set_log_callback'的引用

时间:2014-09-06 15:25:32

标签: c++ compilation

我正在Windows上编译一些使用Tor的软件,这需要libevent。在编译结束时,我被困在以下链接的页面中。

https://github.com/neutrinofoundation/neutrino-digital-currency/blob/master/src/tor/compat_libevent.c

我收到下面显示的错误,但是无法找到解决此问题的方法以允许编译完整的包。对于Linux,解决方案似乎是添加-levent但无法找到Windows的解决方案。任何帮助解决这个问题将不胜感激。

./build\compat_libevent.o:compat_libevent.c:(.text+0x35b): undefined reference t
o `event_set_log_callback'
./build\compat_libevent.o:compat_libevent.c:(.text+0x392): undefined reference t
o `event_config_new'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3ac): undefined reference t
o `event_config_set_flag'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3c3): undefined reference t
o `event_config_set_num_cpus_hint'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3d3): undefined reference t
o `event_config_set_flag'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3db): undefined reference t
o `event_base_new_with_config'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3e8): undefined reference t
o `event_config_free'
./build\compat_libevent.o:compat_libevent.c:(.text+0x3f9): undefined reference t
o `event_base_get_method'
./build\compat_libevent.o:compat_libevent.c:(.text+0x400): undefined reference t
o `event_get_version'
./build\compat_libevent.o:compat_libevent.c:(.text+0x4ec): undefined reference t
o `event_base_get_method'
./build\compat_libevent.o:compat_libevent.c:(.text+0x53b): undefined reference t
o `event_get_version'
./build\compat_libevent.o:compat_libevent.c:(.text+0x55d): undefined reference t
o `event_get_version'
./build\compat_libevent.o:compat_libevent.c:(.text+0x57b): undefined reference t
o `event_get_version'
./build\compat_libevent.o:compat_libevent.c:(.text+0x665): undefined reference t
o `event_new'
./build\compat_libevent.o:compat_libevent.c:(.text+0x681): undefined reference t
o `event_add'
./build\compat_libevent.o:compat_libevent.c:(.text+0x752): undefined reference t
o `event_free'
./build\compat_libevent.o:compat_libevent.c:(.text+0x501): undefined reference t
o `event_get_version'
c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bi
n/ld.exe: ./build\compat_libevent.o: bad reloc address 0x20 in section `.eh_fram
e'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:441: recipe for target 'release\neutrino-qt.exe' failed
mingw32-make: *** [release\neutrino-qt.exe] Error 1

我使用gcc 4.8.2在带有MingW32的Windows 7 64位上构建。 gcc -v的完整输出在下面。

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.8.2/lto-wra
pper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=i686-w64-mingw32 --buil
d=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c
/mingw482/i686-482-posix-dwarf-rt_v3-r2/mingw32 --with-gxx-include-dir=/mingw32/
i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib
--enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=ye
s --enable-threads=posix --enable-libgomp --enable-lto --enable-graphite --enabl
e-checking=release --enable-fully-dynamic-string --enable-version-specific-runti
me-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --di
sable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --en
able-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-
werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tun
e=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw482/prerequisite
s/i686-w64-mingw32-static --with-mpfr=/c/mingw482/prerequisites/i686-w64-mingw32
-static --with-mpc=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-isl=
/c/mingw482/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw482/prere
quisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i
686-posix-dwarf, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.ne
t/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw482/i686-482-posix-dwarf-rt_v3-
r2/mingw32/opt/include -I/c/mingw482/prerequisites/i686-zlib-static/include -I/c
/mingw482/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/
c/mingw482/i686-482-posix-dwarf-rt_v3-r2/mingw32/opt/include -I/c/mingw482/prere
quisites/i686-zlib-static/include -I/c/mingw482/prerequisites/i686-w64-mingw32-s
tatic/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw482/i686-482-posix-dwarf-rt_v3
-r2/mingw32/opt/lib -L/c/mingw482/prerequisites/i686-zlib-static/lib -L/c/mingw4
82/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 4.8.2 (i686-posix-dwarf, Built by MinGW-W64 project)

1 个答案:

答案 0 :(得分:0)

您是否尝试在编译脚本结束时添加-levent? 所以,它会像:

gcc -o a a.c -levent