Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 841716 - dev-libs/capstone-5.0_r2: .pc and cmake files specify wrong include path (was: dev-util/rizin-0.3.4 fails to compile with capstone-5.0_r2)
Summary: dev-libs/capstone-5.0_r2: .pc and cmake files specify wrong include path (was...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: mario.haustein
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-04-29 16:05 UTC by Kobboi
Modified: 2022-05-11 02:11 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.gz (build.log.gz,14.35 KB, application/gzip)
2022-04-29 16:06 UTC, Kobboi
Details
emerge-info.txt (emerge-info.txt,7.82 KB, text/plain)
2022-04-29 16:06 UTC, Kobboi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kobboi 2022-04-29 16:05:57 UTC
[272/1270] x86_64-pc-linux-gnu-gcc -Ilibrz/asm/librz_asm.so.0.3.4.p -I. -I../rizin-v0.3.4 -I../rizin-v0.3.4/librz/include -Ishlr -I../rizin-v0.3.4/shlr -I../rizin-v0.3.4/librz/asm/arch/include -I../rizin-v0.3.4/librz/asm/arch -I../rizin-v0.3.4/librz/asm/arch/h8300 -I../rizin-v0.3.4/librz/asm/arch/hexagon -I../rizin-v0.3.4/librz/asm/arch/msp430 -I../rizin-v0.3.4/librz/asm/arch/rsp -I../rizin-v0.3.4/librz/asm/arch/mcore -I../rizin-v0.3.4/librz/asm/arch/v850 -I../rizin-v0.3.4/librz/asm/arch/propeller -I../rizin-v0.3.4/librz/asm/arch/ebc -I../rizin-v0.3.4/librz/asm/arch/cr16 -I../rizin-v0.3.4/librz/asm/arch/8051 -I../rizin-v0.3.4/librz/asm/arch/v810 -I../rizin-v0.3.4/librz/asm/arch/or1k -Isubprojects/sdb -I../rizin-v0.3.4/subprojects/sdb -Isubprojects/sdb/src -I../rizin-v0.3.4/subprojects/sdb/src -I../rizin-v0.3.4/librz/bin/mangling -I../rizin-v0.3.4/librz/bin/format -I../rizin-v0.3.4/shlr/spp -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch --std=gnu99 -D_GNU_SOURCE -Werror=sizeof-pointer-memaccess -fvisibility=hidden -O2 -march=znver3 -pipe -g -ggdb3 -fPIC -DCAPSTONE_SHARED -DRZ_PLUGIN_INCORE=1 -MD -MQ librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o -MF librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o.d -o librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o -c ../rizin-v0.3.4/librz/asm/p/asm_xcore_cs.c
FAILED: librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o 
x86_64-pc-linux-gnu-gcc -Ilibrz/asm/librz_asm.so.0.3.4.p -I. -I../rizin-v0.3.4 -I../rizin-v0.3.4/librz/include -Ishlr -I../rizin-v0.3.4/shlr -I../rizin-v0.3.4/librz/asm/arch/include -I../rizin-v0.3.4/librz/asm/arch -I../rizin-v0.3.4/librz/asm/arch/h8300 -I../rizin-v0.3.4/librz/asm/arch/hexagon -I../rizin-v0.3.4/librz/asm/arch/msp430 -I../rizin-v0.3.4/librz/asm/arch/rsp -I../rizin-v0.3.4/librz/asm/arch/mcore -I../rizin-v0.3.4/librz/asm/arch/v850 -I../rizin-v0.3.4/librz/asm/arch/propeller -I../rizin-v0.3.4/librz/asm/arch/ebc -I../rizin-v0.3.4/librz/asm/arch/cr16 -I../rizin-v0.3.4/librz/asm/arch/8051 -I../rizin-v0.3.4/librz/asm/arch/v810 -I../rizin-v0.3.4/librz/asm/arch/or1k -Isubprojects/sdb -I../rizin-v0.3.4/subprojects/sdb -Isubprojects/sdb/src -I../rizin-v0.3.4/subprojects/sdb/src -I../rizin-v0.3.4/librz/bin/mangling -I../rizin-v0.3.4/librz/bin/format -I../rizin-v0.3.4/shlr/spp -I/usr/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch --std=gnu99 -D_GNU_SOURCE -Werror=sizeof-pointer-memaccess -fvisibility=hidden -O2 -march=znver3 -pipe -g -ggdb3 -fPIC -DCAPSTONE_SHARED -DRZ_PLUGIN_INCORE=1 -MD -MQ librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o -MF librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o.d -o librz/asm/librz_asm.so.0.3.4.p/p_asm_xcore_cs.c.o -c ../rizin-v0.3.4/librz/asm/p/asm_xcore_cs.c
../rizin-v0.3.4/librz/asm/p/asm_xcore_cs.c:6:10: fatal error: capstone.h: No such file or directory
    6 | #include <capstone.h>
      |          ^~~~~~~~~~~~
compilation terminated.

Reproducible: Always
Comment 1 Kobboi 2022-04-29 16:06:13 UTC
Created attachment 775341 [details]
build.log.gz
Comment 2 Kobboi 2022-04-29 16:06:14 UTC
Created attachment 775344 [details]
emerge-info.txt
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-04-29 21:21:17 UTC
From new capstone's /usr/lib64/pkgconfig/capstone.pc:

prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib64
includedir=${prefix}/include

Name: capstone
Description: Capstone disassembly engine
Version: ..
URL: http://www.capstone-engine.org
archive=${libdir}/libcapstone.a
Libs: -L${libdir} -lcapstone
Cflags: -I${includedir}
archs=

Evidently this version is invalid, which makes the Rizin's version check for meson fail and fall back to the cmake configuration:

Dependency capstone found: NO found .. but need: '>=3.0.4'
Found CMake: /usr/bin/cmake (3.23.1)

But.. the include path is wrong, just like in the above .pc:

/usr/lib64/cmake/capstone/capstone-config.cmake:set_and_check(capstone_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")

Because the capstone headers are in /usr/include/capstone/. The 4.0 .pc file reflects this, too:

/usr/lib64/pkgconfig/capstone.pc:includedir=${prefix}/include/capstone

So it seems that capstone is wrong here?
Comment 4 Larry the Git Cow gentoo-dev 2022-04-29 21:34:58 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e3785c564306494717ebf59f66387f39c5b4bac

commit 1e3785c564306494717ebf59f66387f39c5b4bac
Author:     John Helmert III <ajak@gentoo.org>
AuthorDate: 2022-04-29 21:30:13 +0000
Commit:     John Helmert III <ajak@gentoo.org>
CommitDate: 2022-04-29 21:34:48 +0000

    profiles: mask broken capstone
    
    Bug: https://bugs.gentoo.org/841716
    Signed-off-by: John Helmert III <ajak@gentoo.org>

 profiles/package.mask | 5 +++++
 1 file changed, 5 insertions(+)
Comment 5 mario.haustein 2022-04-30 09:00:41 UTC
Upstream changed include path settings several times in the past. See

* https://github.com/capstone-engine/capstone/pull/1276
* https://github.com/capstone-engine/capstone/issues/1339
* https://github.com/capstone-engine/capstone/issues/1807

It seems projects depending on capstone are required to alter their #include directives from "#include <capstone.h>" to "#include <capstone/capstone.h>" (see https://www.capstone-engine.org/lang_c.html) when switching to capstone 5.

Fixing it by patching capstone.pc would only be temporary solution. Projects depending on capstone have to cope with this breaking changes from capstone 4 to 5.

I will think about a solution.
Comment 6 Larry the Git Cow gentoo-dev 2022-05-11 02:11:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06a5564d904fa957f9dd5c31ba69511122d3a1bb

commit 06a5564d904fa957f9dd5c31ba69511122d3a1bb
Author:     Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
AuthorDate: 2022-04-30 16:57:45 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-05-11 02:11:01 +0000

    profiles: unmask capstone
    
    Restrict revdeps to Capstone 4, which don't build against newer Capstone
    versions.
    
    Closes: https://bugs.gentoo.org/841716
    Signed-off-by: Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
    Closes: https://github.com/gentoo/gentoo/pull/25270
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/package.mask | 6 ------
 1 file changed, 6 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f161266557c6d49226102e8df0725789639f993

commit 3f161266557c6d49226102e8df0725789639f993
Author:     Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
AuthorDate: 2022-04-30 17:02:06 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-05-11 02:11:00 +0000

    dev-libs/capstone: fix version statement in pkg-config file
    
    Bug: https://bugs.gentoo.org/841716
    Package-Manager: Portage-3.0.30, Repoman-3.0.3
    Signed-off-by: Mario Haustein <mario.haustein@hrz.tu-chemnitz.de>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{capstone-5.0_rc2.ebuild => capstone-5.0_rc2-r1.ebuild} |  4 ++++
 dev-libs/capstone/files/capstone-5.0_rc2-pkgconfig.patch    | 13 +++++++++++++
 2 files changed, 17 insertions(+)