LibYAML installation (Linux / Unix)

LibYAML is a library for easily handling YAML files in C language developed and published at http://pyyaml.org/wiki/LibYAML.

Installation

 $ sudo apt-get install libyaml-dev
 $ apt-cyg install libyaml-devel

It is written on the assumption that apt-cyg is installed.

--From the source code

 $ wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
 $ tar zxvf yaml-0.1.5.tar.gz
 $ cd yaml-0.1.5
 $ ./configure --prefix=$HOME/rootfs
 $ make
 $ make install

When installing from source, you can use "--prefix" to install in the specified directory, so you can install even on a server whose root privileges are not published. (I think that the same thing can be done with apt-get and apt-cyg by expanding the package archive to the home directory etc., maybe.)

Sample source and compilation

When you open A libyaml Tutorial, you can see the sample yaml file and the sample source for reading and writing.

How to compile

--For Linux

 $ gcc -lyaml test.c

I think that the library can be compiled either before or after the source file.

--For Cygwin

 $ gcc test.c -lyaml

It may be environment dependent, but the order of gcc command options seems to be fixed. If you do not specify the library in the order of source file → library, compilation will not pass. (Maybe my compilation environment is special ...)

--When installed in a file path other than the default file path

 $ gcc -I${HOME}/rootfs/include/ -L${HOME}/rootfs/lib/ test.c -lyaml

Specify the directory path where yaml.h is stored with "-I", and specify the directory where libyaml.a is stored with "-L".

Recommended Posts

LibYAML installation (Linux / Unix)
Linux mint installation procedure
[Linux] Installation of nvm
Seurat in Linux (installation)
Arch Linux installation notes
Alpine Linux 3.13 installation, Japanese input
Full-human self-made Arch Linux memorandum # 1 installation
Installation of OMC Cloud Agent --Linux-
Linux
Teamviewer for Linux installation procedure (CentOS)
Beginners have learned about Unix (Linux).
Oracle Database 18c installation (Linux CentOS 7 edition)
Recursively get FTP directory on UNIX / LINUX
WSL2 (Windows Subsystem for Linux) installation procedure
Understand the "temporary" part of UNIX / Linux
Arch Linux Installation Guide (UEFI Desktop Edition)