Newbie: Compiling 5.6.3 for Mobile?

55 views
Skip to first unread message

jh...@emocha.com

unread,
Dec 3, 2015, 5:52:08 PM12/3/15
to Crypto++ Users
I have been researching building crypto for OSX and mobile (iOS/Android). There are numerous statements about 5.6.3 "has the mobile patches applied", however looking at the git repo, there a number of build-related files missing or, the instructions are missing. It seems that mobile support is very close to being in the mainline, such that since 5.6.3, there are only a few files to be added and simple instructions to be followed and some simple mods.

Referencing:

There is the statement on both pages that "Note: use <X,Y> below if you are using Crypto++ 5.6.3, or you are using Crypto++'s GitHub prior to 5.6.3. GitHub and 5.6.3 have the changes needed for mobile applied." I have found this to NOT be true. I inferred from the statement that the make file was edited for mobile. That is not true. GNUmakefile-cross is still needed, and it needs to be downloaded outside of github (from the wiki).
I parsed the statement as:

if ( 5.6.3 || GitHub < 5.6.3): Use <X,Y>
else (< 5.6.3 || GitHub >= 5.6.3) : use nothing outside of the repo (I'm using GitHub: 0059f486ad0467d5c4dc692db99a5a5f96c2a733) 

For the platforms there are setenv-{platform}.sh scripts, and GNUmakefile-cross,  referenced in the instructions. Could we also get the set-env scripts into the git repo, as well as some make_{platform}.sh scripts? It would be nice if we didn't need GNUmakefile-cross at all.


Android:
Modification suggested to setenv-android.sh: Add API level17 (4.2)
. /setenv-android.sh #note the period-space
make -f GNUmakefile-cross static dynamic cryptest.exe

iOS:
Modification required to setenv-ios.sh: Add more recent SDKs (9.1, 9.0, etc.) (line 170: for i in ...
. /setenv-ios.sh  device #note the period-space
make -f GNUmakefile-cross static  cryptest.exe

Thoughts? Comments? Did I completely miss something or mess something up?









Jeffrey Walton

unread,
Dec 3, 2015, 7:20:40 PM12/3/15
to Crypto++ Users


On Thursday, December 3, 2015 at 5:52:08 PM UTC-5, jh...@emocha.com wrote:
I have been researching building crypto for OSX and mobile (iOS/Android). There are numerous statements about 5.6.3 "has the mobile patches applied", however looking at the git repo, there a number of build-related files missing or, the instructions are missing. It seems that mobile support is very close to being in the mainline, such that since 5.6.3, there are only a few files to be added and simple instructions to be followed and some simple mods.

Ah, funny you should mention it.... I just came to the group to ask what they wanted to do with a couple of files.
 

Referencing:

There is the statement on both pages that "Note: use <X,Y> below if you are using Crypto++ 5.6.3, or you are using Crypto++'s GitHub prior to 5.6.3. GitHub and 5.6.3 have the changes needed for mobile applied." I have found this to NOT be true. I inferred from the statement that the make file was edited for

Those docs need to be updated, so that's part of the problem here. Its an ugly mashup of old and new and they are not clear. It needs to be fixed because its confusing users.

The "new stuff" was added recently because of https://github.com/weidai11/cryptopp/issues/59 . I closed it because the compile worked with the additional information. But its really a documentation problem that can now go away since 5.6.3 has been released
(once we have time to update it).
 
mobile. That is not true. GNUmakefile-cross is still needed, and it needs to be downloaded outside of github (from the wiki).

GNUmakefile-cross is available at GiHub; see https://github.com/weidai11/cryptopp/blob/master/GNUmakefile-cross.

Can you confirm the GNUmakefile-cross is missing from somewhere, and state where that somewhere is? (Sourceforge, GitHub, release ZIP, etc).
 
I parsed the statement as:

if ( 5.6.3 || GitHub < 5.6.3): Use <X,Y>
else (< 5.6.3 || GitHub >= 5.6.3) : use nothing outside of the repo (I'm using GitHub: 0059f486ad0467d5c4dc692db99a5a5f96c2a733) 

OK, what we were trying to capture was.... changes needed to the source files were committed, like the mod needed for Android at https://github.com/weidai11/cryptopp/commit/54d72d091e68b4845c058a763463ed6193de2561. Before about 5.6.3, you had to download a patch and apply it yourself.

Some stuff is still needed, like the setenv-*.sh.


For the platforms there are setenv-{platform}.sh scripts, and GNUmakefile-cross,  referenced in the instructions. Could we also get the set-env scripts into the git repo, as well as some make_{platform}.sh scripts? It would be nice if we didn't need GNUmakefile-cross at all.

That's exactly what I was going to ask about.

I talked to Wei about it a last week (or the week before), and asked if we should use an Extra/ folder to hold stuff like setenv-*.sh, and Gabriel's Android.mk (https://github.com/weidai11/cryptopp/pull/3). He was OK with including it directly in the root of the distro.

So, they question to the group is: does anyone object to adding setenv-*.sh and Android.mk to the root directory?

Jeff

Jeffrey Walton

unread,
Dec 3, 2015, 7:30:49 PM12/3/15
to Crypto++ Users

For the platforms there are setenv-{platform}.sh scripts, and GNUmakefile-cross,  referenced in the instructions. Could we also get the set-env scripts into the git repo, as well as some make_{platform}.sh scripts? It would be nice if we didn't need GNUmakefile-cross at all.

And about requiring a separate makefile...

When we developed those scripts 3 or 4 years ago, we were managing the native and cross compiles in a single makefile (as you suggested). We found it easier to separate them, especially around OS X and iOS. I imagine things have gotten just as hairy for Android and X86.

It was easier on us to take this path because the makefile has an implicit assumption about the host being the target. After we split them, the rules became quite simple:

  * GNUmakefile - target is host
  * GNUmakefile-cross - target is not host

GNUmakefile-cross includes Android, Embedded and iOS (IIRC).

There are other ways to do a cross-compile, however. For example, a Debian Chroot usually works nicely (https://cryptopp.com/wiki/Debian_Chroot).

Jeff

jh...@emocha.com

unread,
Dec 3, 2015, 7:53:58 PM12/3/15
to Crypto++ Users
My only comment would be that given a "complete" "mobile" configuration (Android AND iOS)  that there be some generic mobile target that would package the lib* files appropriately to avoid them all overwriting libcryptopp.a. And for that matter, the .o and exes should probably managed as well, which gets me into potentially suggesting build directories. Currently, you have to make clean when switching platforms. 

Jeffrey Walton

unread,
Dec 3, 2015, 8:56:27 PM12/3/15
to Crypto++ Users


On Thursday, December 3, 2015 at 7:53:58 PM UTC-5, jh...@emocha.com wrote:
My only comment would be that given a "complete" "mobile" configuration (Android AND iOS)  that there be some generic mobile target that would package the lib* files appropriately to avoid them all overwriting libcryptopp.a. And for that matter, the .o and exes should probably managed as well, which gets me into potentially suggesting build directories. Currently, you have to make clean when switching platforms. 

The common use case for folks using the library is to make in-place and then execute. If the object files and source files are not side-by-side, then configuring the debugger to match objects to sources becomes another task. That means we have complicated the task and have to field the questions.

If you are trying to do this (as opposed to speaking hypothetically), then drive the Makefile through a script. Let the makefile make the targets, and then move the artifacts where you would like them. After each run, perform a 'make clean'. I do the same when building fat libraries on iOS.

Crypto++ is safe for fat libraries, unlike, say, OpenSSL or cURL.

Jeff

jh...@emocha.com

unread,
Dec 4, 2015, 11:33:02 AM12/4/15
to Crypto++ Users


On Thursday, December 3, 2015 at 7:20:40 PM UTC-5, Jeffrey Walton wrote:

Can you confirm the GNUmakefile-cross is missing from somewhere, and state where that somewhere is? (Sourceforge, GitHub, release ZIP, etc).

My report about that being missing is wrong. I was not in the cloned directory, but in an old snapshot.
 

Jeffrey Walton

unread,
Dec 7, 2015, 10:18:10 AM12/7/15
to Crypto++ Users


On Thursday, December 3, 2015 at 5:52:08 PM UTC-5, jh...@emocha.com wrote:
I have been researching building crypto for OSX and mobile (iOS/Android). There are numerous statements about 5.6.3 "has the mobile patches applied", however looking at the git repo, there a number of build-related files missing or, the instructions are missing. It seems that mobile support is very close to being in the mainline, such that since 5.6.3, there are only a few files to be added and simple instructions to be followed and some simple mods.

OK, so we updated the scripts and the procedures at https://cryptopp.com/wiki/Android_(Command_Line) .

We are still in that "close to being mainline" mode. The source file changes have already been checked in (they were checked in before 5.6.3). The setenv-android.sh needs to be added; and the updated GNUmakefile-cross needs to be checked-in.

We will get them checked-in as 5.7/6.0 approaches. That's about a month away.

Jeff
Reply all
Reply to author
Forward
0 new messages