Jan 5 master branch - ios simulator i386 error

100 views
Skip to first unread message

jh...@emocha.com

unread,
Jan 13, 2016, 11:38:41 AM1/13/16
to Crypto++ Users
This is happening with a jan 5 checkout of the master branch.  Is this fixed?

Also, I'm using SDK 9.2, which required a setenv-ios.sh edit.


$ . ./setenv-ios.sh simulator i386
$ make -f GNUmakefile-cross -j 8
...
clang++ -DNDEBUG -g2 -Os -fPIC -pipe -Wall -Wno-delete-non-virtual-dtor  -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk -stdlib=libc++ -c sha.cpp
sha.cpp:313:2: error: invalid instruction mnemonic 'movsl'
        AS1(    rep movsd)
        ^
./cpu.h:267:17: note: expanded from macro 'AS1'
        #define AS1(x) GNU_AS1(x)
                       ^
./cpu.h:262:21: note: expanded from macro 'GNU_AS1'
        #define GNU_AS1(x) #x ";" NEW_LINE
                           ^
<scratch space>:215:2: note: expanded from here
"rep movsd"
 ^
<inline asm>:23:5: note: instantiated into assembly here
rep movsd;
    ^~~~~~
sha.cpp:313:2: error: invalid instruction mnemonic 'movsl'
        AS1(    rep movsd)
        ^
./cpu.h:267:17: note: expanded from macro 'AS1'
        #define AS1(x) GNU_AS1(x)
                       ^
./cpu.h:262:21: note: expanded from macro 'GNU_AS1'
        #define GNU_AS1(x) #x ";" NEW_LINE
                           ^
<scratch space>:215:2: note: expanded from here
"rep movsd"
 ^
<inline asm>:23:5: note: instantiated into assembly here
rep movsd;
    ^~~~~~
sha.cpp:313:2: error: invalid instruction mnemonic 'movsl'
        AS1(    rep movsd)
        ^
./cpu.h:267:17: note: expanded from macro 'AS1'
        #define AS1(x) GNU_AS1(x)
                       ^
./cpu.h:262:21: note: expanded from macro 'GNU_AS1'
        #define GNU_AS1(x) #x ";" NEW_LINE
                           ^
<scratch space>:215:2: note: expanded from here
"rep movsd"
 ^
<inline asm>:23:5: note: instantiated into assembly here
rep movsd;
    ^~~~~~
3 errors generated.
make: *** [sha.o] Error 1

Jeffrey Walton

unread,
Jan 13, 2016, 5:07:52 PM1/13/16
to Crypto++ Users


On Wednesday, January 13, 2016 at 11:38:41 AM UTC-5, jh...@emocha.com wrote:
This is happening with a jan 5 checkout of the master branch.  Is this fixed?

Probably not since you are working from Master.
 
Also, I'm using SDK 9.2, which required a setenv-ios.sh edit.

If you don't mind me asking, what did you change?
 
$ . ./setenv-ios.sh simulator i386
$ make -f GNUmakefile-cross -j 8
...

Add -DCRYPTOPP_DISABLE_ASM for now.

I thought we finished the Clang Integrated Assembler cut-in, but it appears there are some loose ends. Prior to the cut-in, everything using Clang required -DCRYPTOPP_DISABLE_ASM.

Clang and its integrated assembler is challenging. LLVM Clang and Apple Clang use different versioning schemes, and the integrated assembler does not consume Intel syntax. And the Linux port appears to have some additional patches, so it almost like we are dealing with 3 different compilers/assemblers.

Jeff

jh...@emocha.com

unread,
Jan 14, 2016, 12:13:41 PM1/14/16
to Crypto++ Users
Just adding 9.2  around line 170:

# XCODE_SDK is the SDK name/version being used - adjust the list as appropriate.
# For example, remove 4.3, 6.2, and 6.1 if they are not installed. Note: Apple
# makes this available under Xcode via $(SDK_NAME).
for i in 9.2 9.1 9.0 8.2 8.1 8.0 7.2 7.1 7.0 6.2 6.1 6.0 5.1 5.0 4.3 do
do

Jeffrey Walton

unread,
Jan 14, 2016, 12:26:57 PM1/14/16
to Crypto++ Users


On Thursday, January 14, 2016 at 12:13:41 PM UTC-5, jh...@emocha.com wrote:
Just adding 9.2  around line 170:

# XCODE_SDK is the SDK name/version being used - adjust the list as appropriate.
# For example, remove 4.3, 6.2, and 6.1 if they are not installed. Note: Apple
# makes this available under Xcode via $(SDK_NAME).
for i in 9.2 9.1 9.0 8.2 8.1 8.0 7.2 7.1 7.0 6.2 6.1 6.0 5.1 5.0 4.3 do

I think we need to rework that area. It was OK when we only had choices between 6.x and 4.3. But its getting unwieldy now.

I also think we need to rework the command interface so that its like Android's:

    ./setenv-ios.sh armv7        # use LLVM's stdc++
    ./setenv-ios.sh armv7 llvm     # use LLVM's stdc++
    ./setenv-ios.sh armv7 gnu     # don't use LLVM's stdc++
    ./setenv-ios.sh armv7s
    ./setenv-ios.sh simulator    # i386 simulator build
    ....

Consistency and simplicity is important to avoid user troubles.

What do you think?

Jeff

jh...@emocha.com

unread,
Jan 14, 2016, 1:01:28 PM1/14/16
to Crypto++ Users
I also think we need to rework the command interface so that its like Android's:

    ./setenv-ios.sh armv7        # use LLVM's stdc++
    ./setenv-ios.sh armv7 llvm     # use LLVM's stdc++
    ./setenv-ios.sh armv7 gnu     # don't use LLVM's stdc++
    ./setenv-ios.sh armv7s
    ./setenv-ios.sh simulator    # i386 simulator build
    ....

Consistency and simplicity is important to avoid user troubles.

What do you think?

My Apple platforms are: 
  • AppleTVOS.platform
  • AppleTVSimulator.platform
  • MacOSX.platform
  • WatchOS.platform
  • WatchSimulator.platform
  • iPhoneOS.platform
  • iPhoneSimulator.platform
Each has their own versions (Apple TV only has 9.1, iPhone and iPhoneSimulator have 9.2, WatchOS has 2.1)
Simulator may need i386, or x86_64, depending on the device being simulated.

The Apple app store requires screenshots of various iPhones and iPads, and I don't think most people will have all the devices. (3.5 to 5.5" screens) (That's how I found that AS1 issue - building for the simulator to get screenshots) It makes me wonder again about a general 'all' script or target.





Jeffrey Walton

unread,
Jan 14, 2016, 1:54:07 PM1/14/16
to Crypto++ Users


My Apple platforms are: 
  • AppleTVOS.platform
  • AppleTVSimulator.platform
  • MacOSX.platform
  • WatchOS.platform
  • WatchSimulator.platform
  • iPhoneOS.platform
  • iPhoneSimulator.platform
Each has their own versions (Apple TV only has 9.1, iPhone and iPhoneSimulator have 9.2, WatchOS has 2.1)
Simulator may need i386, or x86_64, depending on the device being simulated.

Oh, wow. The list of SDKs has gotten big. There's definitely some pain points, like trying to build for Apple TV and Watch.

How do you think the script should operate? Or how would you expect to use it? (The open question for me is how to select, say, ARMv7 and ARMv7s, since they are both iPhoneOS).

Jeff

jh...@emocha.com

unread,
Jan 14, 2016, 3:11:53 PM1/14/16
to Crypto++ Users
 Well I have no idea the use cases for WatchOS and the like, iPhone is clearly dominant. So I think just wrapping the do in another do for card-coded iPhoneOS, iPhoneSimulator, since these are not added often. We use an iPhone 4S, which is about as far back as you can reasonably go (2010). ARMv7, The 5 is a ARM7s variety. http://iossupportmatrix.com/

As for the SDKs:
for i in `ls`; do ls -l $i/Developer/SDKs; done
total 8
drwxrwxr-x  7 root  wheel  238 Jan  6 12:02 AppleTVOS.sdk
lrwxr-xr-x  1 root  wheel   13 Jan  6 12:01 AppleTVOS9.1.sdk -> AppleTVOS.sdk
total 8
drwxrwxr-x  12 root  wheel  408 Jan  6 12:03 AppleTVSimulator.sdk
lrwxr-xr-x   1 root  wheel   20 Jan  6 12:01 AppleTVSimulator9.1.sdk -> AppleTVSimulator.sdk
total 0
drwxr-xr-x  5 root  wheel  170 Jan  6 12:03 MacOSX10.11.sdk
total 8
drwxrwxr-x  8 root  wheel  272 Jan  6 12:05 WatchOS.sdk
lrwxr-xr-x  1 root  wheel   11 Jan  6 12:02 WatchOS2.1.sdk -> WatchOS.sdk
total 8
drwxrwxr-x  12 root  wheel  408 Jan  6 12:05 WatchSimulator.sdk
lrwxr-xr-x   1 root  wheel   18 Jan  6 12:02 WatchSimulator2.1.sdk -> WatchSimulator.sdk
total 8
drwxrwxr-x  8 root  wheel  272 Jan  6 12:05 iPhoneOS.sdk
lrwxr-xr-x  1 root  wheel   12 Jan  6 12:01 iPhoneOS9.2.sdk -> iPhoneOS.sdk
total 8
drwxrwxr-x  12 root  wheel  408 Jan  6 12:06 iPhoneSimulator.sdk
lrwxr-xr-x   1 root  wheel   19 Jan  6 12:02 iPhoneSimulator9.2.sdk -> iPhoneSimulator.sdk


Maybe just drop the version and use the symlinks?

Jeffrey Walton

unread,
Jan 21, 2016, 1:27:28 PM1/21/16
to Crypto++ Users
My Apple platforms are: 
  • AppleTVOS.platform
  • AppleTVSimulator.platform
  • MacOSX.platform
  • WatchOS.platform
  • WatchSimulator.platform
  • iPhoneOS.platform
  • iPhoneSimulator.platform
Each has their own versions (Apple TV only has 9.1, iPhone and iPhoneSimulator have 9.2, WatchOS has 2.1)
Simulator may need i386, or x86_64, depending on the device being simulated.

Oh, wow. The list of SDKs has gotten big. There's definitely some pain points, like trying to build for Apple TV and Watch.

How do you think the script should operate? Or how would you expect to use it? (The open question for me is how to select, say, ARMv7 and ARMv7s, since they are both iPhoneOS).

Jeff

 Well I have no idea the use cases for WatchOS and the like, iPhone is clearly dominant. So I think just wrapping the do in another do for card-coded iPhoneOS, iPhoneSimulator, since these are not added often. We use an iPhone 4S, which is about as far back as you can reasonably go (2010). ARMv7, The 5 is a ARM7s variety. http://iossupportmatrix.com/

As for the SDKs:
for i in `ls`; do ls -l $i/Developer/SDKs; done
total 8
drwxrwxr-x  7 root  wheel  238 Jan  6 12:02 AppleTVOS.sdk
lrwxr-xr-x  1 root  wheel   13 Jan  6 12:01 AppleTVOS9.1.sdk -> AppleTVOS.sdk
total 8
...


Maybe just drop the version and use the symlinks?

Yeah, that sounds like a good idea. Do you know how far back it works with Xcode?

As for the other issues surrounding the script, it seems we really need to control:

 * SDK and version (IPhoneOS, WatchOS, etc)
    - your solution

* Architecture
    - maybe, depending on 32 vs 64-bit
    - can we use, say ARMv7 for ARMv7s
    - should be OK as we don't use SIMD insns
    - may require -force_cpusubtype_ALL
    - maybe architecture should be optional
      - if not specified, use common subset (ARMv7 for ARMv7s)
      - if specified, use it instead (user asked for ARMv7s)

* C++ runtime
    - still need GNU vs LLVM
    - LLVM by default

That means we would invoke the script as:

    # iPhone, ARMv7, LLVM
    ./setenv-ios iPhoneOS

    # iPhone, ARMv7s, LLVM
    ./setenv-ios iPhoneOS armv7s

    # iPhone, ARMv7, GNU
    ./setenv-ios iPhoneOS gnu

    # iPhone, ARMv7s, GNU
    ./setenv-ios iPhoneOS armv7s gnu

    # iWatch (ARM or MIPS or AVR?), LLVM
    ./setenv-ios WatchOS

   ...

Fat binaries has been a pain point for me for years. Rather than supporting them in the script, maybe we should just state a policy of "we don't do them; use xcrun and lipo to create them".

Jeffrey Walton

unread,
Mar 9, 2016, 12:10:16 AM3/9/16
to Crypto++ Users


On Wednesday, January 13, 2016 at 11:38:41 AM UTC-5, jh...@emocha.com wrote:
This is happening with a jan 5 checkout of the master branch.  Is this fixed?

Also, I'm using SDK 9.2, which required a setenv-ios.sh edit.

OK, we added two files tonight. First was an updated iOS environment script. It was simplified from the earlier one. You can invoke it with:

    setenv-ios.sh <SDK> <ARCH>

SDK is optional, and it can be one of the following. By default, its iPhoneOS.

  * iPhoneOS
  * iPhoneSimulator
  * WatchOS
  * WatchSimulator
  * AppleTVOS
  * AppleTVSimulator

ARCH is optional, and it can be one of the following. By Default, its ARMv7 if SDK is iPhoneOS. Its i386 if SDK is iPhoneSimulator.

  * i386
  * x86_64
  * ARMv5
  * ARMv6
  * ARMv7
  * ARMv7s
  * ARM64

You no longer have to worry about things like LLVM's libc++ vs GNU's stdlibc++. LLVM's runtime has been default since at least Xcode 5.0, and allowing a choice has mostly caused linking problems under iOS.

The second file added was a test script that builds the Crypto++ library under whatever Xcode supports. The script is a smoke test and should help catch breaking changes. We still need to run 'cryptest.exe' under a Jailbroken device.

The files provided under "Added iOS environment and test script", Commit a78b9dfa0840f92f (http://github.com/weidai11/cryptopp/commit/a78b9dfa0840f92fed9d61f1a4a3b5ce403e55fd). Please look them over, kick the tires and report any problems.

We'll get the Android stuff added next.

Jeff
Reply all
Reply to author
Forward
0 new messages