How To Install libcmocka.x86_64 on Amazon Linux 2

In this tutorial we learn how to install libcmocka.x86_64 in Amazon Linux 2. libcmocka.x86_64 is Lightweight library to simplify and generalize unit tests for C

Introduction

In this tutorial we learn how to install libcmocka.x86_64 on Amazon Linux 2.

What is libcmocka.x86_64

There are a variety of C unit testing frameworks available however many of them are fairly complex and require the latest compiler technology. Some development requires the use of old compilers which makes it difficult to use some unit testing frameworks. In addition many unit testing frameworks assume the code being tested is an application or module that is targeted to the same platform that will ultimately execute the test. Because of this assumption many frameworks require the inclusion of standard C library headers in the code module being tested which may collide with the custom or incomplete implementation of the C library utilized by the code under test. CMocka only requires a test application is linked with the standard C library which minimizes conflicts with standard C library headers. Also, CMocka tries to avoid the use of some of the newer features of C compilers. This results in CMocka being a relatively small library that can be used to test a variety of exotic code. If a developer wishes to simply test an application with the latest compiler then other unit testing frameworks may be preferable. This is the successor of Google’s Cmockery.

We can use yum to install libcmocka.x86_64 on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install libcmocka.x86_64.

Install libcmocka.x86_64 on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install libcmocka.x86_64 using yum by running the following command:

sudo yum -y install libcmocka.x86_64

How To Uninstall libcmocka.x86_64 on Amazon Linux 2

To uninstall only the libcmocka.x86_64 package we can use the following command:

sudo yum remove libcmocka.x86_64

libcmocka.x86_64 Package Contents on Amazon Linux 2

/usr/lib64/libcmocka.so.0
/usr/lib64/libcmocka.so.0.4.1
/usr/share/doc/libcmocka-1.1.1
/usr/share/doc/libcmocka-1.1.1/AUTHORS
/usr/share/doc/libcmocka-1.1.1/COPYING
/usr/share/doc/libcmocka-1.1.1/ChangeLog
/usr/share/doc/libcmocka-1.1.1/README

References

Summary

In this tutorial we learn how to install libcmocka.x86_64 on Amazon Linux 2 using yum.