botan icon indicating copy to clipboard operation
botan copied to clipboard

Error while compiling botan for Windows 64: Cannot open 'botan/asn1_obj.h in alg_id.cpp!!!

Open oliviervibe opened this issue 2 years ago • 3 comments

Error while compiling botan for Windows 64

I have generated the build for windows with: configure.py --cc=msvc --cpu=x64 --os=windows

Then I run make and I get the following error:

C:/projetcs/TestApplications/pkcs11/botan-master/src/lib/asn1/alg_id.cpp(8): fatal error C1083: Cannot open include file: 'botan/asn1_obj.h': No such file or directory

I looked at the code of alg_id.cpp and I saw that: /*

  • Algorithm Identifier
  • (C) 1999-2007 Jack Lloyd
  • Botan is released under the Simplified BSD License (see license.txt) */

#include <botan/asn1_obj.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/oids.h>

Where is the folder botan!!! The include file asn1_obj.h is directly under the same directory as the file alg_id.cpp.

How can this source compile????? There is no botan folder with .h in all the source tree!!! I took the source from the latest git. Is there something missing in the git download???? All the .h files are under the same directory as the sources.

Can someone explain clearly how to compile this code for the MSVC compiler? Do I miss something?

Thanks

oliviervibe avatar Nov 09 '21 20:11 oliviervibe

How can this source compile????? There is no botan folder with .h in all the source tree!!!

This directory is being created by configure.py with symlinks (or on Windows I think actually copies since symlinks and hardlinks are touchy on Windows) to the headers that coorespond to the modules which are actually enabled in the build. You should find it in the current directory under build\include\botan.

Can someone explain clearly how to compile this code for the MSVC compiler? Do I miss something?

What you are doing seeings fine so I don't actually understand what the problem might be.

Then I run make

Are you running nmake or some other make? For Windows I think we are only testing nmake (and jom, but jom is mostly nmake compatible).

Can you post the complete output when you run configure.py as well as the full output when you run into an error (including the compiler invocation)?

randombit avatar Nov 09 '21 21:11 randombit

Thanks for your help. At first, I couldn't compile it because of CPU arch mismatch with nmake.

Then it seems that when I called again configure.py the build folder was not correctly created or I accidentally deleted it.

Now it works, the only detail that should be specified is that Visual studio command prompt that must be used needs to be of the same CPU arch as the compilation target.

Question: The result is a DLL, is it possible to eventually create a static library?

At first, I was not a fan of CMake but it has the advantage of creating a windows project for the correct CPU arch if correctly written.

PS: It is not possible to compile with make. It only works with nmake, and nmake must be called from a prompt of the same arch as the target.

oliviervibe avatar Nov 10 '21 09:11 oliviervibe

The result is a DLL, is it possible to eventually create a static library?

You can call configure.py with the --build-targets=static option to build a static library.

reneme avatar Nov 15 '21 08:11 reneme

I'm assuming your build problems are now resolved and all questions answered. If not please reopen the issue.

lieser avatar Sep 21 '22 10:09 lieser