[botan-devel] Error During make (can't build Botan)

Jack Lloyd lloyd at randombit.net
Fri Dec 2 08:59:20 EST 2011


On Fri, Dec 02, 2011 at 08:45:17AM -0500, Brad Tilley wrote:

> $ make
> 
> src\utils\dyn_load\dyn_load.cpp: In member function 'void*
> Botan::Dynamically_Loaded_Library::resolve_symbol(const std::string&)':
> src\utils\dyn_load\dyn_load.cpp:68:56: error: invalid conversion from 'int
> (*)()' to 'void*'
> make: *** [build\lib\utils_dyn_load.obj] Error 1
> 
> Here is the gcc version:
> 
> Using built-in specs.
> COLLECT_GCC=C:\MinGW\bin\gcc.exe
> COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
> Target: mingw32
> Configured with: ../gcc-4.5.2/configure
> --enable-languages=c,c++,ada,fortran,objc,obj-c++
> --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp
> --disable-win32-registry --enable-libstdcxx-debug
> --enable-version-specific-runtime-libs --disable-werror --build=mingw32
> --prefix=/mingw
> Thread model: win32
> gcc version 4.5.2 (GCC)

This isn't TR1 related. The line that's failing was only ever tested
(by me at least) under Visual C++ as it's calling a Win32
function. Apparently GCC is unhappy with converting a function pointer
to a void*, which is reasonable enough. I don't have MinGW installed
but the patch below should fix it.

-Jack

#
# old_revision [ea68c910a808338888cf3f2bac71d592e9a056bb]
#
# patch "src/utils/dyn_load/dyn_load.cpp"
#  from [38417a971c1cfb0f8453746700becbe353df00e4]
#    to [27cde529ba93177424d7931b40f4d48aecef6944]
#
============================================================
--- src/utils/dyn_load/dyn_load.cpp     38417a971c1cfb0f8453746700becbe353df00e4
+++ src/utils/dyn_load/dyn_load.cpp     27cde529ba93177424d7931b40f4d48aecef6944
@@ -65,7 +65,8 @@ void* Dynamically_Loaded_Library::resolv
 #if defined(BOTAN_TARGET_OS_HAS_DLOPEN)
    addr = ::dlsym(lib, symbol.c_str());
 #elif defined(BOTAN_TARGET_OS_HAS_LOADLIBRARY)
-   addr = ::GetProcAddress((HMODULE)lib, symbol.c_str());
+   addr = reinterpret_cast<void*>(::GetProcAddress((HMODULE)lib,
+                                                   symbol.c_str()));
 #endif
 
    if(!addr)




More information about the botan-devel mailing list