0

I have been trying in vain to get this test program to compile

   #include <botan/botan.h>


   int main()
   {
       Botan::LibraryInitializer init;
   }

I have downloaded library source from the website. I ran configure.py, which ran fine. I then attempted to run MinGW-make

This is the error I got

c:\Botan-1.11.7>mingw32-make
g++  -m64 -pthread -fPIC -fvisibility=hidden -std=c++11 -D_REENTRANT -fstack-pro
tector -O3 -momit-leaf-frame-pointer -Wall -Wextra -Wstrict-aliasing -Wstrict-ov
erflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wold-s
tyle-cast -Wzero-as-null-pointer-constant -Ibuild\include -c C:\Botan-1.11.7\src
\lib\algo_base\scan_name.cpp -o build\obj\lib\src_lib_algo_base_scan_name.obj
C:\Botan-1.11.7\src\lib\algo_base\scan_name.cpp:1:0: warning: -fPIC ignored for
target (all code is position independent) [enabled by default]
C:\Botan-1.11.7\src\lib\algo_base\scan_name.cpp:1:0: sorry, unimplemented: 64-bi
t mode not compiled in
mingw32-make: *** [build\obj\lib\src_lib_algo_base_scan_name.obj] Error 1

I searched Google and any available forum I could find. I found prebuilt libraries for windows in a hidden folder on their site. However the package contained lib and dll files and not .a files which MinGW requires. I tries to use a program LIB2A which created a .a file. I have added this file into my code::blocks linker options. I also included the include folder.

When I try to compile I get this error.

C:\botan\include\botan\init.h|41|undefined reference to `_imp___ZN5Botan18LibraryInitializer10initializeERKSs'|

It seems like it cannot see the library with function definitions, but I am lost on where to go from here.

Sanoob
  • 2,466
  • 4
  • 30
  • 38
MadOgre
  • 501
  • 6
  • 15

1 Answers1

0

mingw32-make has the -m64 flag set, which means it's trying to build a 64 bit library. To build a 64 bit library, you'll need to get MinGW-w64.

When you ran configure.py, it likely set up your MakeFile to build a 64 bit library. You'll want to check what options are set in its output. This includes the option to build 32 bit or 64 bit. Either way, you'll want some variant of this: python configure.py --os=mingw --cc=gcc

This question had a similar error, and suggested using MinGW-w64, which will allow you to build a 64 bit library: Building 64 bit dll with MinGW 32 bit in Eclipse

In order to build with mingw32-make off the command line, you'll need to also add the MinGW-w64 bin directory to your Windows path, and likely remove the Code::Blocks packaged MinGW from your path to avoid conflicts. You'll still use mingw32-make to build the library with MinGW-w64; even though it's named mingw32-make, it will build 64 bit.

If you decide to build the library 64 bit, you'll need to build your application 64 bit as well, so you'll want to set up MinGW-w64 for Code::Blocks. To set MinGW-w64 up in Code::Blocks, see this question: Setting up MingW and Code::Blocks in Windows 8 64 bit.

Community
  • 1
  • 1
Andrew Dolby
  • 799
  • 1
  • 13
  • 25