Closed nazar554 closed 9 years ago
Is it caused by this?
INFO: Disabling shared lib on mingw
I am currently trying to build with --os=cygwin
(disable non-mingw modules) to try shared libs, but I think it is the wrong way(I get build errors about missing functions).
The problem is caused by building a static library without amalgamation. This will probably work in the upcoming release 1.11.21 early in October. For now you can try the amalgamation by adding --via-amalgamation
So shared build on mingw
is not supported?
I tried --disable-shared -via-amalgamation
and --with-boost
but my build is failing:
INFO: Platform: OS="Windows" machine="AMD64" proc="Intel64 Family 6 Model 60 Stepping 3, GenuineIntel"
INFO: Guessing target processor is a x86_64/x86_64 (use --cpu to set)
INFO: Target is gcc-mingw-x86_64-x86_64
INFO: Skipping, by request only - cvc
INFO: Skipping, incompatible CPU - mp_x86_32 simd_altivec
INFO: Skipping, incompatible OS - beos_stats dev_random dyn_load egd locking_allocator proc_walk unix_procs
INFO: Skipping, incompatible compiler - mp_x86_32_msvc
INFO: Skipping, loaded only if needed by dependency - mp_generic simd_scalar
INFO: Skipping, requires external dependency - openssl
INFO: Using MP module mp_x86_64
INFO: Using SIMD module simd_sse2
INFO: Loading modules adler32 aead aes aes_ni aes_ssse3 aont asn1 auto_rng base base64 bcrypt benchmark bigint block blowfish boost bzip2 camellia cascade cast cbc cbc_mac ccm cfb chacha chacha20poly1305 clmul cmac codec_filt comb4p compression crc24 crc32 cryptoapi_rng cryptobox ctr curve25519 datastor des dh dl_algo dl_group dlies dsa eax ec_gfp ec_group ecb ecc_key ecdh ecdsa elgamal eme_oaep eme_pkcs1 eme_raw emsa1 emsa1_bsi emsa_pkcs1 emsa_pssr emsa_raw emsa_x931 entropy fd_unix ffi filters fpe_fe1 gcm gost_28147 gost_3410 gost_3411 has160 hash hash_id hex hkdf hmac hmac_drbg hmac_rng hres_timer http_util idea idea_sse2 if_algo kasumi kdf kdf1 kdf2 keccak keypair lion lzma mac mars mce mceies md2 md4 md5 mdx_hash mgf1 misty1 mode_pad modes mp mp_x86_64 noekeon noekeon_simd nr numbertheory ocb ofb oid_lookup openpgp par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pk_pad poly1305 prf_tls prf_x942 pubkey rc2 rc4 rc5 rc6 rdrand rfc3394 rfc6979 rmd128 rmd160 rng rsa rw safer salsa20 seed serpent serpent_simd sessions_sql sessions_sqlite3 sha1 sha1_sse2 sha2_32 sha2_64 simd simd_sse2 siphash siv skein sqlite3 srp6 stream system_rng tea threefish threefish_avx2 tiger tls tss twofish utils whirlpool win32_stats x509 x919_mac x931_rng xtea xtea_simd xts zlib
INFO: Enabling use of external dependency boost
INFO: Enabling use of external dependency bzip2
INFO: Enabling use of external dependency lzma
INFO: Enabling use of external dependency sqlite3
INFO: Enabling use of external dependency zlib
INFO: Assuming CPU is little endian
INFO: Assuming unaligned memory access works
INFO: Using hardlink to link files into build dir (use --link-method to change)
INFO: Writing amalgamation header to botan_all.h
INFO: Writing amalgamation source to botan_all.cpp
INFO: Writing amalgamation source to botan_all_aesni.cpp
INFO: Writing amalgamation source to botan_all_ssse3.cpp
INFO: Writing amalgamation source to botan_all_rdrand.cpp
INFO: Writing amalgamation source to botan_all_avx2.cpp
INFO: Botan 1.11.20 (released dated 20150907) build setup is complete
g++ -m64 -pthread -fstack-protector -std=c++11 -D_REENTRANT -c -O2 -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Ibuild/include botan_all.cpp -o build/obj/lib/botan_all.o
g++ -m64 -pthread -fstack-protector -maes -mpclmul -mssse3 -std=c++11 -D_REENTRANT -c -O2 -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Ibuild/include botan_all_aesni.cpp -o build/obj/lib/botan_all_aesni.o
g++ -m64 -pthread -fstack-protector -mssse3 -std=c++11 -D_REENTRANT -c -O2 -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Ibuild/include botan_all_ssse3.cpp -o build/obj/lib/botan_all_ssse3.o
g++ -m64 -pthread -fstack-protector -mrdrnd -std=c++11 -D_REENTRANT -c -O2 -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Ibuild/include botan_all_rdrand.cpp -o build/obj/lib/botan_all_rdrand.o
g++ -m64 -pthread -fstack-protector -mavx2 -std=c++11 -D_REENTRANT -c -O2 -Wall -Wextra -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Ibuild/include botan_all_avx2.cpp -o build/obj/lib/botan_all_avx2.o
In file included from G:/msys64/mingw64/include/boost/asio/detail/win_tss_ptr.hpp:23:0,
from G:/msys64/mingw64/include/boost/asio/detail/tss_ptr.hpp:25,
from G:/msys64/mingw64/include/boost/asio/detail/call_stack.hpp:20,
from G:/msys64/mingw64/include/boost/asio/impl/handler_alloc_hook.ipp:19,
from G:/msys64/mingw64/include/boost/asio/handler_alloc_hook.hpp:80,
from G:/msys64/mingw64/include/boost/asio/detail/handler_alloc_helpers.hpp:21,
from G:/msys64/mingw64/include/boost/asio/detail/bind_handler.hpp:19,
from G:/msys64/mingw64/include/boost/asio/detail/wrapped_handler.hpp:18,
from G:/msys64/mingw64/include/boost/asio/io_service.hpp:24,
from G:/msys64/mingw64/include/boost/asio/basic_io_object.hpp:19,
from G:/msys64/mingw64/include/boost/asio/basic_socket.hpp:20,
from G:/msys64/mingw64/include/boost/asio/basic_datagram_socket.hpp:20,
from G:/msys64/mingw64/include/boost/asio.hpp:21,
from botan_all.cpp:21525:
G:/msys64/mingw64/include/boost/asio/detail/socket_types.hpp:24:4: error: #error WinSock.h has already been included
# error WinSock.h has already been included
^
In file included from G:/msys64/mingw64/include/boost/asio/detail/socket_types.hpp:38:0,
from G:/msys64/mingw64/include/boost/asio/detail/win_tss_ptr.hpp:23,
from G:/msys64/mingw64/include/boost/asio/detail/tss_ptr.hpp:25,
from G:/msys64/mingw64/include/boost/asio/detail/call_stack.hpp:20,
from G:/msys64/mingw64/include/boost/asio/impl/handler_alloc_hook.ipp:19,
from G:/msys64/mingw64/include/boost/asio/handler_alloc_hook.hpp:80,
from G:/msys64/mingw64/include/boost/asio/detail/handler_alloc_helpers.hpp:21,
from G:/msys64/mingw64/include/boost/asio/detail/bind_handler.hpp:19,
from G:/msys64/mingw64/include/boost/asio/detail/wrapped_handler.hpp:18,
from G:/msys64/mingw64/include/boost/asio/io_service.hpp:24,
from G:/msys64/mingw64/include/boost/asio/basic_io_object.hpp:19,
from G:/msys64/mingw64/include/boost/asio/basic_socket.hpp:20,
from G:/msys64/mingw64/include/boost/asio/basic_datagram_socket.hpp:20,
from G:/msys64/mingw64/include/boost/asio.hpp:21,
from botan_all.cpp:21525:
G:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
#warning Please include winsock2.h before windows.h
^
botan_all.cpp:21525
#if defined(BOTAN_HAS_BOOST_ASIO)
#include <boost/asio.hpp>
#endif
It looks like windows.h
was included before boost/asio.hpp
(by Win32 CryptoAPI EntropySource), Boost ASIO in turn includes winsock.h
. Any ideas how to pull out #include <windows.h>
from es_capi.cpp
without disabling the module? Or at least put it lower in the source file?
Also build without Boost fails in botan-test.exe
(i get non-zero return in PKGBUILD check()
):
fuzzer: Exception escaped test: No filesystem access enabled.
===============
Tests 1 FAILs
Yes, shared libs are not supported on MinGW due to the strange mix of Unix and Windows technologies and the lack of development resources and interest. I am sure it can be done but I also think it's not an easy pick.
Header order: could you try moving the <boost/asio.hpp>
include up, e.g. below #include "botan_all_internal.h"
?
The test fail is fixed in the upcoming release 1.11.21, see #276.
Could you please try static build (--disable-shared
) without amalgamation using the new 1.11.21 release?
Through some patching I managed to compile a working x86_64 MinGW build. I had to:
-mt
suffix to boost_system,boost_filesystem
in src/lib/utils/boost/info.txt
because MSYS2 MinGW Boost has only -mt
variantmingw -> advapi32,ws2_32,mswsock
) in src/lib/entropy/cryptoapi_rng/info.txt
because I didn't know where to put it--destdir='$(DESTDIR)'
so it gets expanded in the Makefile) install everything to correct directory because configure.py
script didn't work with --prefix
and --destdir
correctly in my case (I can't use ${pkgdir}
to set destdir until the script runs the package()
function)However, i686 build is failing with this error:
./libbotan-1.11.a(utils_calendar.o):calendar.cpp:(.text+0x713): undefined reference to _mkgmtime32
It is a MSVC C library function, so linking to some library won't help. I will investigate if a workaround is possible.
For now I forced calendar.cpp
to use boost_timegm
, and it fixed the i686 build.
Nice work!
Link to winsock2
Any idea why we don't need ws2_32 and mswsock on Windows using MSVC? Those libraries could be added to the info.txt file for the proper module by just adding
<libs>
mingw -> ws2_32,mswsock
</libs>
Do you know where those are used?
Through some clever hack install everything to correct directory because configure.py script didn't work with --prefix and --destdir correctly in my case
The hack is indeed really fancy. --prefix
kind of the same as --destdir
, so I'll try to get rid of one. We need to know the installation dir at configure time for a number of generated files, so it is not easy to change it. The other option you have would be to call install.py
manually if your current hack starts to cause problems.
However, i686 build is failing with this error: ./libbotan-1.11.a(utils_calendar.o):calendar.cpp:(.text+0x713): undefined reference to _mkgmtime32
Is this a MinGW bug? We can easily drop the mkgmtime
OS feature from src/build-data/os/mingw.txt
. In fact your patch should do exactly that if you know that boost is available.
@mouse07410 could you please stop posting your own problems under unrelated issues? This is a MinGW threat. Get a fucking Github client, or a browser, open Botan issues page and you'll find the right ticket there. If not, open one. I remove your comment as non-constructive and annoying. Next time, I'll remove without comment.
And please stop replying to Github conversations via email. Nobody wants to see your signature and full quotes. And get the fucking context before writing anything! You're wasting people's time.
I am closing this due to inactivity. Feel free to open more specific follow-up issues if those occur when packaging new versions of Botan or you want to refactor your packaging process.
I am trying to package botan for MSYS2 (MinGW-Packages). Currently it builds OK but the tests fail. The problem is somewhere in
ffi.cpp
. Looks like a double delete in destructor. I see this in both debug and release builds (64-bit).Backtrace
MSYS2 uses ported pacman, so here is my debug PKGBUILD
build()