edit-icon download-icon


Last Updated: Mar 20, 2018

C++ is special, so we recommend that you use the methods described in this topic to compile and copy build/release/src/tablestore/core/impl/buildinfo.cpp for backup. Then copy the C++ SDK source code and buildinfo.cpp to your own code library and compile it using your compilation system.

Compilation parameters

When compiling the client-side code, some compiler behaviors must be ensured. This means that some compiler parameters are required.

The GCC compiler parameters are described as follows.

Parameter Required Description
--std=gnu++03 Yes Supports C++98 TR1 language with GCC extension (that is, typeof).
-pthread Yes Required parameter for multithreaded programming. This parameter is required for both compiling and linking.
-fwrapv Yes Rotate upon integer overflow. Specifically, this yields 0 in the case of an unsigned integer overflow and the smallest negative number in the case of a signed integer overflow. The client checks overflow based on this behavior.
-O2 Recommended Optimization grade. In general, a higher optimization grade is not recommended.
-fsanitize=address and-fvar-tracking-assignments Recommended Later versions than gcc-4.9 support libasan, a lightweight detector that can quickly detect errors in memory usage. If you need Table Store developers to locate errors, please take these two compilation errors so that the error can be reproduced. You must also take the previous parameter when linking.
Note: libasan and valgrind are incompatible.

Environment dependency and pre-compiled packages

The Debian 8 system is used here as an example to demonstrate how to generate pre-compiled packages.

  1. Open the docker/debian8/Dockerfile file and select dockerfile to export the environment dependency of the client on the system. This method automatically guarantees the consistency between the code and the environment.

    1. RUN apt-get install -y scons g++ libboost-all-dev protobuf-compiler libprotobuf-dev uuid-dev libssl-dev
    2. RUN apt-get install -y ca-certificates # for HTTPS support

    The SDK depends on the following:

    • scons & gcc: Compilation system
    • boost
    • uuid
    • protobuf: serialization library
    • openssl: signature, used to support HTTPS
    • ca-certificates: used to support HTTPS only. If you only use the Table Store HTTP address, you can choose not to install this library. We recommend that you use the more secure HTTPS.
  2. You can compile the client after installing these packages. Download the source code of the client and run scons in the source code directory.

    1. $ git clone https://github.com/aliyun/aliyun-tablestore-cpp-sdk.git
    2. $ cd aliyun-tablestore-cpp-sdk
    3. $ scons -j4

Once these steps have been completed, a tar package is compiled. Typically, you can find the package name in the final output of scons. For example, the package name and path of the Debian 8 system are: build/release/pkg/aliyun-tablestore-cpp98-sdk-4.4.1-debian8.9-x86_64.tar.gz.

  • The package name includes the following elements:

    • C++ version (C++98)
    • SDK version (4.4.1)
    • OS version (Debian 8.9)
    • OS architecture (x86_64)
  • The contents of the package include:

    1. $ tar -tf build/release/pkg/aliyun-tablestore-cpp98-sdk-4.4.1-debian8.9-x86_64.tar.gz
    2. version.ini
    3. lib/libtablestore_core.so
    4. lib/libtablestore_core_static.a
    5. lib/libtablestore_util.so
    6. lib/libtablestore_util_static.a
    7. include/tablestore/util/arithmetic.hpp
    8. include/tablestore/util/assert.hpp
    9. include/tablestore/util/foreach.hpp
    10. include/tablestore/util/iterator.hpp
    11. include/tablestore/util/logger.hpp
    12. include/tablestore/util/logging.hpp
    13. include/tablestore/util/mempiece.hpp
    14. include/tablestore/util/mempool.hpp
    15. include/tablestore/util/metaprogramming.hpp
    16. include/tablestore/util/move.hpp
    17. include/tablestore/util/optional.hpp
    18. include/tablestore/util/prettyprint.hpp
    19. include/tablestore/util/random.hpp
    20. include/tablestore/util/result.hpp
    21. include/tablestore/util/security.hpp
    22. include/tablestore/util/seq_gen.hpp
    23. include/tablestore/util/threading.hpp
    24. include/tablestore/util/timestamp.hpp
    25. include/tablestore/util/try.hpp
    26. include/tablestore/util/assert.ipp
    27. include/tablestore/util/iterator.ipp
    28. include/tablestore/util/logging.ipp
    29. include/tablestore/util/mempiece.ipp
    30. include/tablestore/util/move.ipp
    31. include/tablestore/util/prettyprint.ipp
    32. include/tablestore/core/client.hpp
    33. include/tablestore/core/error.hpp
    34. include/tablestore/core/range_iterator.hpp
    35. include/tablestore/core/retry.hpp
    36. include/tablestore/core/types.hpp

    The package currently includes the following elements:

    • Version file: version.ini
    • Library files: all files under lib/. Where libtablestore_core_static.a depends on libtablestore_util_static.a. The Moments library is similar.
    • Header files: all files under include/.
Thank you! We've received your feedback.