All Products
Search
Document Center

Object Storage Service:Installation (C SDK)

Last Updated:Nov 29, 2025

Install the OSS C SDK to manage OSS buckets, upload and download files, manage data, and process images. This topic describes how to install the OSS C SDK.

Prerequisites

Install the GCC and G++ compilers, version 4.8 or later, to support basic C99 and GNU99 syntax.

Background information

When you install the OSS C SDK, you must also install the CMake build tool and the third-party libraries curl, apr, apr-util, and minixml.

Name

Description

Version requirements

CMake

Build tool.

3.10.0 or later

curl

Resolves network issues.

7.32.0 or later

apr-util

Handles memory management and cross-platform issues.

1.5.2 or later

minixml

Parses the XML returned by a request.

Version 2.9 is recommended.

Install on Linux

  1. Install CMake.

    Red Hat/Alibaba Cloud/CentOS

    sudo yum install cmake 

    Ubuntu/Debian

    sudo apt-get install cmake 

    SuSE

    sudo zypper install cmake 
  2. Install the third-party libraries.

    Red Hat/Alibaba Cloud/CentOS

    1. Install the curl library.

      yum -y install libcurl-devel
    2. Install the apr library.

      yum install apr-util
      yum install apr-devel
      yum install apr-util-devel
    3. Install the minixml library.

      1. Download the minixml library.

        wget "https://github.com/michaelrsweet/mxml/releases/download/release-2.9/mxml-2.9.tar.gz"
      2. Decompress the minixml library file.

        tar zxf mxml-2.9.tar.gz
      3. Navigate to the folder.

        cd mxml-2.9
      4. Compile and install the minixml library.

        ./configure
        make
        sudo make install

    Ubuntu/Debian

    sudo apt-get install libcurl4-openssl-dev libapr1-dev libaprutil1-dev libmxml-dev                                    

    SuSE

    sudo zypper install libcurl-devel libapr1-devel libapr-util1-devel mxml-devel 
  3. Install the C SDK.

    1. Download the OSS C SDK source package.

      The following example uses version 3.10.0. For the download link, see GitHub.

    2. Decompress the package.

      tar zxf aliyun-oss-c-sdk-3.10.0.tar.gz
    3. Navigate to the folder.

      cd aliyun-oss-c-sdk-3.10.0
    4. Install the C SDK.

      cmake .
      make
      sudo make install

      If the curl, apr, apr-util, and mxml third-party libraries are not installed in the default path, you must specify their installation paths when you install the SDK.

      cmake -f CMakeLists.txt
      // The build type is Release. Common build types are Debug, Release, RelWithDebInfo, and MinSizeRel. The default is Debug.
      -DCMAKE_BUILD_TYPE=Release
      // Custom installation folder.
      -DCMAKE_INSTALL_PREFIX=/usr/local/
      // Specify the folders where the header files and library files of the curl, apr, apr-util, and xml third-party libraries are located.
      -DCURL_INCLUDE_DIR=/usr/include/curl
      -DCURL_LIBRARY=/usr/lib64/libcurl.so
      -DAPR_INCLUDE_DIR=/usr/include/apr-1
      -DAPR_LIBRARY=/usr/lib64/libapr-1.so
      -DAPR_UTIL_INCLUDE_DIR=/usr/include/apr-1
      -DAPR_UTIL_LIBRARY=/usr/lib64/libaprutil-1.so
      -DMINIXML_INCLUDE_DIR=/usr/include
      -DMINIXML_LIBRARY=/usr/lib64/libmxml.so
      // If the "Could not find apr-config/apr-1-config" error is reported during compilation, it is because the apr-1-config file cannot be found in the default path. Add this option.
      -DAPR_CONFIG_BIN=/path/to/bin/apr-1-config
      // If the "Could not find apu-config/apu-1-config" error is reported during compilation, it is because the apu-1-config file cannot be found in the default path. Add this option.
      -DAPU_CONFIG_BIN=/path/to/bin/apu-1-config                            
  4. Compile the sample project.

    1. Download the sample project.

      wget https://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/32132/cn_zh/1487730555529/aliyun-oss-c-sdk-demo.tar.gz
    2. Decompress the sample project.

      tar zxf aliyun-oss-c-sdk-demo.tar.gz
      Note

      When you install oss-c-sdk-demo-specified-installation, you must specify the installation folder, such as **/home/your/oss/csdk**. Other sample projects use the default installation paths of the OSS C SDK and its dependency libraries, so you do not need to specify an installation folder. For more information about installing the sample project, see Use the Alibaba Cloud OSS C SDK on Linux.

    3. Compile the sample project.

      1. Navigate to the project folder (oss-c-sdk-demo-xxx).

      2. Run make to compile the sample project.

        Note

        Replace OSS_ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET, and BUCKET_NAME in the sample code with valid values. If the dynamic libraries for the OSS C SDK and its dependencies are not in a system library path, use LD_LIBRARY_PATH to specify their location when you run the program.

      3. Run ./main to run the executable program.

        To recompile, run make clean.

Install on Windows

  1. Download and install the OSS C SDK.

  2. Download and decompress the sample project.

  3. Use Visual Studio to compile the sample project.

    • If you use Visual Studio 2012 or a later version, you are prompted to upgrade the project to use the latest compiler and libraries. We recommend that the editor and library versions match your project version. If your project is compatible with the latest compiler and libraries, click Upgrade. Otherwise, do not upgrade.

    • Before you compile the sample project, replace OSS_ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET, BUCKET_NAME, OBJECT_NAME, MULTIPART_UPLOAD_FILE_PATH, and DIR_NAME in oss_config.c with valid values.

    • For detailed steps and frequently asked questions (FAQ) about using Visual Studio to run the sample project, see Compile and use the Alibaba Cloud OSS C SDK on Windows.