Skip to content

Arm cross #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,9 @@ if(PLATFORM_WINDOWS)
endif()
elseif(PLATFORM_LINUX OR PLATFORM_ANDROID OR PLATFORM_APPLE)
# max warning level, warnings are errors, turn off unused private field. We have one for an empty class.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -pedantic -Wextra")
# remove -Werror for StringUtils
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
Expand Down
22 changes: 22 additions & 0 deletions CROSS_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
************************************************
Two sets of changes in this pull request:

1) Fixes to BucketLocationConstraint -
Region.h and .cpp in core
BucketLocationConstraint.h and .cpp in S3
I made the two lists equivalent, got rid of extraneous and old regions. I made the default us-east-1. I'm not sure that's exactly right but the old code wasn't working very well for me.

2) Changes to cross compile under Ubuntu 15.10 for ARM Linux. Three shell scripts to help along - cross-cmake.sh to cross compile the entire SDK, client.sh to compile client code, and move-libs.sh to move the libraries to a target ARM board.

To compile for ARM LINUX:

1) Edit cross-cmake.sh to point CROSS_COMPILER to your ARM compiler
2) run cross-cmake.sh. If you blow up in StringUtilities with a warning you will have to edit CMakeLists.txt and get rid of -Werror. You may need to do this in two places - the top level and the core (aws-cpp-sdk-core). Once the CMAKE script gets to the integration tests (at 100%) it will blow up. This is normal and mean you are done with this phase. This may take a while.
3) Move libraries (.so) to the target ARM board. I have an example shell script if your target is connected via network. You don't have to move all of them - just the ones you need. Step 5 will tell you what's missing if you don't have a lot of extra space on your target.
4) Compile your target code. Client.sh is set up for S3 and DynamoDb - you will have to add or subtract include paths and libraries for other client needs.
5) Move your code to the target board and try running it. You will probably be missing libraries from the LIB path - hunt them down and either move them to the LIB path or expand the LIB path. You will also have to set two environmental variables for AWS with the correct keys with the priviledges needed for your client. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

Once it's set up it works very well. Good luck.

Maurice Bizzarri

3 changes: 2 additions & 1 deletion aws-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ if(NOT PLATFORM_WINDOWS)
if(PLATFORM_LINUX OR PLATFORM_ANDROID OR PLATFORM_APPLE)
# max warning level, warnings are errors, turn off unused private field. We have one for an empty class.
# We also have some nested comments in the auto-generated member comments so turn that off as well
target_compile_options(aws-cpp-sdk-core PRIVATE -Wall -Werror -Wno-comment)
#remove -Werror due to StringUtilies problem
target_compile_options(aws-cpp-sdk-core PRIVATE -Wall -Wno-comment)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(aws-cpp-sdk-core PRIVATE -Wno-unused-private-field)
Expand Down
9 changes: 7 additions & 2 deletions aws-cpp-sdk-core/include/aws/core/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include <aws/core/Core_EXPORTS.h>

#include <aws/core/utils/memory/stl/AWSString.h>
/*
* changed Region to add CN and EU_Central
* Maurice Bizzarri
*/

namespace Aws
{
Expand All @@ -30,12 +34,13 @@ namespace Aws
US_WEST_1,
US_WEST_2,
EU_WEST_1,
EU_CENTRAL_1,
AP_SOUTHEAST_1,
AP_SOUTHEAST_2,
AP_NORTHEAST_1,
AP_NORTHEAST_2,
SA_EAST_1
SA_EAST_1,
CN_NORTH_1,
EU_CENTRAL_1
};

namespace RegionMapper
Expand Down
2 changes: 1 addition & 1 deletion aws-cpp-sdk-core/include/aws/core/VersionConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
* permissions and limitations under the License.
*/

#define AWS_SDK_VERSION_STRING "0.9.6-89-gd53c4a3"
#define AWS_SDK_VERSION_STRING "0.9.6-90-g8581d6e"
6 changes: 6 additions & 0 deletions aws-cpp-sdk-core/source/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
*/

#include <aws/core/Region.h>
/*
* added CN_NORTH_1
* Maurice Bizzarri
*/

using namespace Aws;

Expand Down Expand Up @@ -46,6 +50,8 @@ const char* GetRegionName(Region region)
return "ap-northeast-2";
case Region::SA_EAST_1:
return "sa-east-1";
case Region::CN_NORTH_1:
return "cn-north-1";
default:
return "us-east-1";
}
Expand Down
12 changes: 8 additions & 4 deletions aws-cpp-sdk-s3/include/aws/s3/model/BucketLocationConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#pragma once
#include <aws/s3/S3_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

/*
* changed BucketLocationConstraint to match
* Region.h in core
* Maurice Bizzarri
*/
namespace Aws
{
namespace S3
Expand All @@ -24,14 +28,14 @@ namespace Model
{
enum class BucketLocationConstraint
{
NOT_SET,
EU,
eu_west_1,
us_east_1,
us_west_1,
us_west_2,
eu_west_1,
ap_southeast_1,
ap_southeast_2,
ap_northeast_1,
ap_northeast_2,
sa_east_1,
cn_north_1,
eu_central_1
Expand Down
36 changes: 27 additions & 9 deletions aws-cpp-sdk-s3/source/model/BucketLocationConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@

using namespace Aws::Utils;

static const int EU_HASH = HashingUtils::HashString("EU");
static const int us_east_1_HASH = HashingUtils::HashString("us-east-1");
static const int eu_west_1_HASH = HashingUtils::HashString("eu-west-1");
static const int us_west_1_HASH = HashingUtils::HashString("us-west-1");
static const int us_west_2_HASH = HashingUtils::HashString("us-west-2");
static const int ap_southeast_1_HASH = HashingUtils::HashString("ap-southeast-1");
static const int ap_southeast_2_HASH = HashingUtils::HashString("ap-southeast-2");
static const int ap_northeast_1_HASH = HashingUtils::HashString("ap-northeast-1");
static const int ap_northeast_2_HASH = HashingUtils::HashString("ap-northeast-2");
static const int sa_east_1_HASH = HashingUtils::HashString("sa-east-1");
static const int cn_north_1_HASH = HashingUtils::HashString("cn-north-1");
static const int eu_central_1_HASH = HashingUtils::HashString("eu-central-1");
/*
* changes to conform to BucketLocationConstraint.h and Region.h
* Maurice Bizzarri
*/

namespace Aws
{
Expand All @@ -43,11 +48,11 @@ namespace Aws
BucketLocationConstraint GetBucketLocationConstraintForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == EU_HASH)
{
return BucketLocationConstraint::EU;
}
else if (hashCode == eu_west_1_HASH)
if (hashCode == us_east_1_HASH)
{
return BucketLocationConstraint::us_east_1;
}
else if (hashCode == eu_west_1_HASH)
{
return BucketLocationConstraint::eu_west_1;
}
Expand All @@ -71,6 +76,10 @@ namespace Aws
{
return BucketLocationConstraint::ap_northeast_1;
}
else if (hashCode == ap_northeast_2_HASH)
{
return BucketLocationConstraint::ap_northeast_2;
}
else if (hashCode == sa_east_1_HASH)
{
return BucketLocationConstraint::sa_east_1;
Expand All @@ -90,15 +99,22 @@ namespace Aws
return static_cast<BucketLocationConstraint>(hashCode);
}

return BucketLocationConstraint::NOT_SET;
return BucketLocationConstraint::us_east_1;
}

/*
* changed to match Region.h in core
* and BucketLocationConstraint.h
* Maurice Bizzarri
*/
Aws::String GetNameForBucketLocationConstraint(BucketLocationConstraint enumValue)
{
switch(enumValue)
{
case BucketLocationConstraint::EU:
return "EU";
// case BucketLocationConstraint::EU:
// return "EU";
case BucketLocationConstraint::us_east_1:
return "us-east-1";
case BucketLocationConstraint::eu_west_1:
return "eu-west-1";
case BucketLocationConstraint::us_west_1:
Expand All @@ -111,6 +127,8 @@ namespace Aws
return "ap-southeast-2";
case BucketLocationConstraint::ap_northeast_1:
return "ap-northeast-1";
case BucketLocationConstraint::ap_northeast_2:
return "ap-northeast-2";
case BucketLocationConstraint::sa_east_1:
return "sa-east-1";
case BucketLocationConstraint::cn_north_1:
Expand Down
13 changes: 13 additions & 0 deletions client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
./make-cross.sh $1.cpp $1 aws-cpp-sdk-core aws-cpp-sdk-dynamodb aws-cpp-sdk-s3 aws-cpp-sdk-transfer
if [ "$?" = "0" ]; then

readelf -h $1
scp -oCiphers=aes128-ctr $1 [email protected]:/home/root/
else
echo "nothing copied or checked!"
exit 1
fi




9 changes: 9 additions & 0 deletions cross-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export ARCH=arm
export CROSS_COMPILER='/home/maurice/core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi'
cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_ARCH=LINUX -DCMAKE_C_FLAGS='-mfloat-abi=hard -L/home/maurice/aws-sdk-cpp/testing-resources ' -DCMAKE_C_COMPILER=${CROSS_COMPILER}-gcc -DCMAKE_CXX_COMPILER=${CROSS_COMPILER}-g++ -DCMAKE_CXX_FLAGS='-mfloat-abi=hard -L/home/maurice/aws-sdk-cpp/testing-resources ' .
export CPATH=/home/maurice/aws-sdk-cpp/testing-resources/include
export C_LIBRARY_PATH=/home/maurice/aws-sdk-cpp/testing-resources
export CXX_LIBRARY_PATH=/home/maurice/aws-sdk-cpp/testing-resources
make


9 changes: 9 additions & 0 deletions make-cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export ARCH=arm
export CROSS_COMPILE=~/core/build/out-glibc/sysroots/x86_64-linux/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-
export CPLUS_INCLUDE_PATH=/home/maurice/aws-sdk-cpp/testing-resources/include:/home/maurice/aws-sdk-cpp/aws-cpp-sdk-core/include:/home/maurice/aws-sdk-cpp/aws-cpp-sdk-dynamodb/include:~/aws-sdk-cpp/aws-cpp-sdk-s3/include:~/aws-sdk-cpp/aws-cpp-sdk-transfer/include
export C_INCLUDE_PATH=/home/maurice/aws-sdk-cpp/testing-resources/include:/home/maurice/aws-sdk-cpp/aws-cpp-sdk-core/include:/home/maurice/aws-sdk-cpp/aws-cpp-sdk-dynamodb/include:~/aws-sdk-cpp/aws-cpp-sdk-transfer/include
export LIBRARY_PATH=/home/maurice/aws-sdk-cpp/aws-cpp-sdk-core:/home/maurice/aws-sdk-cpp/aws-cpp-sdk-dynamodb:~/aws-sdk-cpp/aws-cpp-sdk-s3:~/aws-sdk-cpp/aws-cpp-sdk-transfer
${CROSS_COMPILE}g++ -DAWS_CUSTOM_MEMORY_MANAGEMENT -std=c++11 -mfloat-abi=hard -L/home/maurice/aws-sdk-cpp/aws-cpp-sdk-core -L/home/maurice/aws-sdk-cpp/aws-cpp-sdk-dynamodb -L/home/maurice/aws-sdk-cpp/aws-cpp-sdk-s3 -L/home/maurice/aws-sdk-cpp/aws-cpp-sdk-transfer -o $2 $1 -l$3 -l$4 -l$5 -l$6



1 change: 1 addition & 0 deletions move-lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
find -name *.so -execdir scp -oCiphers=aes128-ctr '{}' [email protected]:/usr/lib \;
13 changes: 13 additions & 0 deletions xmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
./make-cross.sh $1.cpp $1 aws-cpp-sdk-core aws-cpp-sdk-dynamodb aws-cpp-sdk-s3 aws-cpp-sdk-transfer
if [ "$?" = "0" ]; then

readelf -h $1
scp -oCiphers=aes128-ctr $1 [email protected]:/home/root/
else
echo "nothing copied or checked!"
exit 1
fi