On Jan 5, 2015, at 0:09 , Jeffrey Walton <[email protected]> wrote:
>> Hmm, OK. Won’t impact me, as I don’t use non-Apple clang any more, but makes
>> sense for the Crypto++ distro.
>
> Check it out... I'm on OS X 10.8.5, fully patched. No more "clang
> version" string - only "clang" string:
Oh, I did - my logic was “this patch doesn’t make things worse for me, but
helps somebody else”.
As I said, it works.
> Sadly, I'm the guy who gave the string to Wei :( Its was around 2011
> or 2012, back when Apple provided Clang, and the version string was
> something like "Apple clang version ...". Now its "Apple LLVM ..."
> with a Clang version number. And if you build from scratch (or use a
> distro), its only "clang" string.
It’s OK, you’ve atoned for your sin. :-)
Now it’s Apple’s time. :-)
>> # These are required on newer Mac OS X, as somehow they aren't set
>> # up automatically even when the native CPU supports them.
>> CXXFLAGS += -maes -mpclmul -mavx2
>
> I'm still using older stuff. I refused the OS X 10.9 upgrade because
> of moving the KeyChain to the iCloud. I don't do clouds.
You mean - the older CPU that doesn’t have AES-NI, etc.?
> Do you know of any OS X machines that are [internet] accessible to test on?
:-( Sorry, I don’t.
>> It does not need CXXFLAGS (I think) because it’s linking only. Thanks for
>> catching missing LDFLAGS! I’ve added them.
>
> The compiler driver (CXX) is invoking the linker (LD). The compiler
> driver will pick up some flags and automatically perform some linker
> magic (like implicitly adding libraries). To convince yourself, change
> CXXFLAGS to:
>
> CXXFLAGS += -stdlib=libc++
Yes, but since I already have “-stdlib=…” in LDLIBFLAGS (setting matching
what’s in CXXFLAGS!) that is passed to the linker, is it worth bothering?
> CXXFLAGS += -fsanitize=undefined
Hmm… Do we need this?
> And let me know how linking goes ;) You can test it with a `make dynamic`.
:-)
> I abhor “-arch x86_64 -arch i386”
>
> I've kinda grown to like it. The fat binaries make it easy to a
> library to a project. Maybe I'm getting too lazy in my old age.
I don’t have spare disk space, and I don’t have a non-64-bit machines any more.
So no point to complicate life with fat binaries for me.
BTW, cryptopp-5.6.2 builds nicely with Apple native clang (Xode-6.1), and with
gcc-4.8.3. However with gcc-4.9.1 the compiled executable (statically-linked!)
crashes:
Testing MessageDigest algorithm SHA-512.
...
Tests complete. Total tests = 15. Failed tests = 0.
Testing MessageDigest algorithm SHA-3-224.
......Process 12434 stopped
* thread #1: tid = 0x8ca9e5, 0x000000010018f9ce
cryptest.exe`CryptoPP::xorbuf(unsigned char*, unsigned char const*, unsigned
long) + 222, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
frame #0: 0x000000010018f9ce cryptest.exe`CryptoPP::xorbuf(unsigned char*,
unsigned char const*, unsigned long) + 222
cryptest.exe`CryptoPP::xorbuf(unsigned char*, unsigned char const*, unsigned
long) + 222:
-> 0x10018f9ce: vmovdqa %ymm0, (%r13,%r10)
0x10018f9d5: addq $0x20, %r10
0x10018f9d9: cmpq %r9, %rbx
0x10018f9dc: jb 0x10018f9bd ; CryptoPP::xorbuf(unsigned
char*, unsigned char const*, unsigned long) + 205
(lldb) bt
* thread #1: tid = 0x8ca9e5, 0x000000010018f9ce
cryptest.exe`CryptoPP::xorbuf(unsigned char*, unsigned char const*, unsigned
long) + 222, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=EXC_I386_GPFLT)
* frame #0: 0x000000010018f9ce cryptest.exe`CryptoPP::xorbuf(unsigned char*,
unsigned char const*, unsigned long) + 222
frame #1: 0x00000001001d71ab cryptest.exe`CryptoPP::SHA3::Update(unsigned
char const*, unsigned long) + 75
(lldb)
> On Sun, Jan 4, 2015 at 11:39 PM, Mobile Mouse <[email protected]> wrote:
>> On Jan 4, 2015, at 21:14 , Jeffrey Walton <[email protected]> wrote:
>>
>> Hi Mouse,
>>
>> I'd suggest a couple of small corrections here…
>>
>>
>> Thank you!
>>
>> Change:
>> CXX=g++
>> to:
>> CXX ?= g++
>>
>> That keeps the makefile from stepping on the compiler set in the
>> environment. If its not set, then the assignment is performed. Its
>> particularly painful when cross-compiling.
>>
>>
>> Great point! I’ll do that, and hope Jean-Pierre will do the same.
>>
>> Ditto for RANLIB.
>>
>>
>> Same.
>>
>> Change:
>> CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang
>> version")
>> To:
>> CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang”)
>>
>>
>> Hmm, OK. Won’t impact me, as I don’t use non-Apple clang any more, but makes
>> sense for the Crypto++ distro.
>>
>> Apple uses "clang version", while building it from sources does not. So if
>> you built your own Clang or used one from a distro, then its usually
>> mis-identified.
>>
>>
>> Yeah…
>>
>> You should make the above change and then try Mac OS X again and see if you
>> have the same problems with the assembler.
>>
>>
>> What do you mean? That I wouldn’t need to manually add those “-maes
>> -mpclmul” flags? I don’t think so. I’ve experimented on other (not CryptoPP)
>> files, and haven’t found a way to have those flags on unless explicitly set.
>>
>> Am I missing anything here?
>>
>> Oh, and with the above (and below :) changes it still works fine on Mac OS X
>> 10.9.5 (Xcode 6.1).
>>
>> -Os is usually more useful than -O2 or -O3 because it keeps the code tighter
>> and caches hotter.
>>
>>
>> Changed in my makefile, hope Jean-Pierre will do the same. Haven’t noticed
>> size changes, haven’t run the benchmarks (yet).
>>
>> libcryptopp.so target is missing both CXXFLAGS and LDFLAGS.
>>
>>
>> It does not need CXXFLAGS (I think) because it’s linking only. Thanks for
>> catching missing LDFLAGS! I’ve added them.
>>
>>
>> By the way, here's a diff of the Makefile I use (it has a few more
>> changes):http://pastebin.com/xCYekFQ0
>>
>>
>> Thanks, but no thanks. :-)
>>
>> I abhor “-arch x86_64 -arch i386”
>>
>> Here’s the updated makefile:
>> ...
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.