capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Is both libyaml and libcyaml needed for building cstest?

Open kingiler opened this issue 1 year ago • 1 comments

Work environment

Questions Answers
OS/arch/bits Manjaro amd 64
Architecture amd64
Source of Capstone git clone
Version/git commit e46838ed974948b4446c7c478508409e0000aeaa

Expected behavior

With CAPSTONE_BUILD_CSTEST, cmake should able to build cstest. It should attempt to build libyaml from source if not found as stated in the BUILDING.md.

Actual behavior

CMake gives following error message

Could not find libyaml using the following names: libyaml, yaml

From the CMakeLists.txt in suite/cstest/CMakeLists.txt, it contains the following lines

find_library(libyaml
    NAMES libyaml yaml
    REQUIRED)

while having external project for libcyaml.

kingiler avatar Nov 28 '24 11:11 kingiler

libcyaml depends on libyaml. libcyaml is basically a wrapper around the very raw access libyaml provides to parse yaml files. I added it back then, because I was under time constraints. So just using libyaml would have been too much code to write.

Now, why is libyaml a dependency cmake doesn't resolve on its own (by downloading it and building it)? Because libcyaml and libyaml are both ExternalProjects, and I struggled on making them depend on each other. Meaning: first libyaml is checked and maybe built if not present. And then libcyaml.

It didn't seem (or still isn't) possible to do it without some extra work or weird hacks. This "making an ExternalProject depend on another ExternalProject" isn't easily done last time I checked.

I might have overlooked something, but due to the mentioned time constraints I had to stop looking at it and made libyaml a dependency the developer has to install on her own.

I documented this in suite/cstest/README.md but apparently forgot to add a note about it in the BUILDING.md. If you could open a PR to add this note, I would really appreciate it.

Rot127 avatar Nov 28 '24 12:11 Rot127