[Botan-devel] [PATCH] Botan 1.8.7 fails to build with Sun CC

Bernhard Rosenkraenzer bero at arklinux.ch
Wed Oct 14 09:48:44 EDT 2009


Hi,
Botan 1.8.7 works perfectly for me on Linux and FreeBSD - but it fails to
build on current OpenSolaris x86 with current (12update1) SunStudio:

"src/alloc/alloc_mmap/mmap_mem.cpp", line 116: Error: Formal argument 1 of
type char* in call to msync(char*, unsigned, int) is being passed void*.
"src/alloc/alloc_mmap/mmap_mem.cpp", line 120: Error: Formal argument 1 of
type char* in call to munmap(char*, unsigned) is being passed void*.

This one is easy to fix by just casting the first parameters to msync and
munmap to char*... After fixing it, asn1_alt.cpp fails:

CC -Ibuild/include -xO2  +p -D__EXTENSIONS__ +w -c src/asn1/asn1_alt.cpp
-o build/lib/asn1_alt.o
"build/include/botan/bswap.h", line 52: Warning: Conversion of 64 bit type
value to "unsigned" causes truncation.
"build/include/botan/bswap.h", line 53: Warning: Conversion of 64 bit type
value to "unsigned" causes truncation.
"build/include/botan/stl_util.h", line 81: Error: Could not find a match
for std::multimap<std::string, std::string, std::less<std::string>,
std::allocator<std::pair<const std::string,
std::string>>>::insert(std::pair<std::string, std::string>) needed in
Botan::multimap_insert<std::string, std::string>(std::multimap<std::string,
std::string, std::less<std::string>, std::allocator<std::pair<const
std::string, std::string>>>&, const std::string &, const std::string &).
"src/asn1/asn1_alt.cpp", line 49:     Where: While instantiating
"Botan::multimap_insert<std::string,
std::string>(std::multimap<std::string, std::string,
std::less<std::string>, std::allocator<std::pair<const std::string,
std::string>>>&, const std::string &, const std::string &)".
"src/asn1/asn1_alt.cpp", line 49:     Where: Instantiated from
non-template code.
1 Error(s) and 2 Warning(s) detected.

The problem is that Sun CC std::make_pair<const std::string,std::string>
returns a std::pair<std::string,std::string>, which it then refuses to
implicitly cast to std::pair<const std::string,std::string>.
Replacing std::make_pair(key, value) with std::pair<const K, V>(key,
value) fixes it.

datastore.cpp breaks for a similar reason:
CC -Ibuild/include -xO2  +p -D__EXTENSIONS__ +w -c
src/utils/datastor/datastor.cpp -o build/lib/datastor.o
"src/utils/datastor/datastor.cpp", line 56: Error: Could not find a match
for std::multimap<std::string, std::string, std::less<std::string>,
std::allocator<std::pair<const std::string,
std::string>>>::insert(std::pair<std::string, std::string>) needed in
Botan::Data_Store::search_with(const Botan::Data_Store::Matcher&) const.

Lastly, mlock.cpp fails because of an implicit void* to char* cast:
CC -Ibuild/include -xO2  +p -D__EXTENSIONS__ +w -c src/utils/mlock.cpp -o
build/lib/mlock.o
"src/utils/mlock.cpp", line 25: Error: Formal argument 1 of type char* in
call to mlock(char*, unsigned) is being passed void*.
"src/utils/mlock.cpp", line 39: Error: Formal argument 1 of type char* in
call to munlock(char*, unsigned) is being passed void*.


The patch I've attached fixes these issues, but might break other
platforms...

ttyl
bero
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Botan-1.8.7-suncc.patch
Type: text/x-c
Size: 2950 bytes
Desc: not available
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20091014/522e5760/attachment.c>


More information about the botan-devel mailing list