You are not logged in.
I'm trying to package a library which uses CMake (ztd.idk) but after the build makepkg warns that "Package contains reference to $srcdir". I've written this for the PKGBUILD:
pkgname=libztd.idk
# I'm going to hardcode a commit hash because soasis sometimes makes commits that break and doesn't have any versioning
pkgver=af2914a
pkgrel=1
pkgdesc="The IDK (Industrial Development Kit) library!"
url="https://ztdidk.rtfd.io/"
arch=('x86_64')
license=('Apache-2.0')
provides=("ztd-idk")
conflicts=("ztd-idk")
source=(
"$pkgname-$pkgver::git+https://github.com/soasis/idk#commit=$pkgver"
"ztd.cmake::git+https://github.com/soasis/cmake#commit=405bb5d" # a stable version
"gcc-fix.patch"
)
sha512sums=(
'SKIP'
'SKIP'
'74e5051c51b8b63274525c9105216def0d25517b311d410f5a009f7937a9c4c29b87674de4513c0f72acb98b266e978bc42ed1abd9643a2f6734911e02249dc0'
)
makedepends=(
'git'
'cmake'
)
prepare() {
patch -d $pkgname-$pkgver -Np1 -i ../gcc-fix.patch
}
build() {
local cmake_options=(
-B build
-S $pkgname-$pkgver
-W no-dev
-D CMAKE_BUILD_TYPE=None
-D CMAKE_INSTALL_PREFIX=/usr
-D FETCHCONTENT_FULLY_DISCONNECTED=ON
-D FETCHCONTENT_SOURCE_DIR_ZTD.CMAKE="$srcdir/ztd.cmake"
-D BUILD_SHARED_LIBS=ON
)
cmake "${cmake_options[@]}"
cmake --build build
}
check() {
true
}
package() {
DESTDIR="$pkgdir" cmake --install build
install -d "$pkgdir/usr/include"
cp -r "$pkgname"-"$pkgver"/include/* "$pkgdir/usr/include/"
}
(Also the necessary patch until they merge my pr)
---
include/ztd/ranges/counted_iterator.hpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/ztd/ranges/counted_iterator.hpp b/include/ztd/ranges/counted_iterator.hpp
index a120a46..6c235a3 100644
--- a/include/ztd/ranges/counted_iterator.hpp
+++ b/include/ztd/ranges/counted_iterator.hpp
@@ -63,14 +63,16 @@ namespace ztd { namespace ranges {
template <typename _It>
class __counted_iterator {
private:
+ _It _M_it = _It();
+
using _ItDiff = ranges::iterator_difference_type_t<_It>;
static constexpr bool _S_operator_plusplus_noexcept() noexcept {
- return noexcept(++::std::declval<_It&>())&& noexcept(--::std::declval<_ItDiff&>());
+ return noexcept(++::std::declval<_It&>()) && noexcept(--::std::declval<_ItDiff&>());
}
static constexpr bool _S_operator_minusminus_noexcept() noexcept {
- return noexcept(--::std::declval<_It&>())&& noexcept(++::std::declval<_ItDiff&>());
+ return noexcept(--::std::declval<_It&>()) && noexcept(++::std::declval<_ItDiff&>());
}
public:
@@ -263,7 +265,6 @@ namespace ztd { namespace ranges {
}
private:
- _It _M_it = _It();
difference_type _M_count = difference_type {};
};
} // namespace __rng_detail
--
2.51.0
I know the pkgver is bad, I'll fix it later. I'm more concerned with this current issue. I don't want to have to write another patch, especially for their build system. I'm not really a goddess at writing packaging code for CMake, so I don't entirely know what the issue is, but allegedly it has something to do with the "export tree" or "build tree" or something. The relevant code seems to happen here. I'm just hoping that someone here that knows anything about this can help me
Here are the files which end up leaking the build dir:
usr/share/cmake/ztd.idk/ztd.idk-targets.cmake
usr/share/cmake/ztd.version/ztd.version-targets.cmake
usr/share/cmake/ztd.tag_invoke/ztd.tag_invoke-targets.cmake
Thank you in advance to anyone that might be able to help <3
Offline
That's a rather common build warning that can only be solved with sourcecode changes .
Since aur builds are intended to be used locally and the builder already knows the $srcdir location, many people just ignore it.
For packages that are built for use on unknown systems it's different.
Last edited by Lone_Wolf (2025-09-05 09:33:57)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
but isn't it kind of problematic for $srcdir to be present in a cmake targets file? Like, correct me if I'm wrong, but if you try to include this package in cmake with find_package() the source will point to the build location (not /usr/include) because of this:
set_target_properties(ztd.idk PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "\$<\$<BOOL:>:__STDC_WANT_LIB_EXT1__=1>;\$<\$<BOOL:>:_GNU_SOURCE=1>;\$<\$<STREQUAL:\$<TARGET_PROPERTY:ztd.idk,TYPE>,SHARED_LIBRARY>:ZTD_IDK_DLL=1>;dl"
INTERFACE_INCLUDE_DIRECTORIES "/home/[...]/Programming/Packages/ztd-idk/src/libztd.idk-af2914a/include"
INTERFACE_LINK_LIBRARIES "ztd.version;ztd.tag_invoke"
)
# Import target "ztd.idk" for configuration "None"
set_property(TARGET ztd.idk APPEND PROPERTY IMPORTED_CONFIGURATIONS NONE)
set_target_properties(ztd.idk PROPERTIES
IMPORTED_LOCATION_NONE "/home/[...]/Programming/Packages/ztd-idk/src/build/bin/libztd.idk.so"
IMPORTED_SONAME_NONE "libztd.idk.so"
)
or will cmake figure out that this is bs and fix it?
Offline
It's not what you want, question is where this is coming from.
See eg. https://gitlab.archlinux.org/archlinux/ … type=heads
Do you get this when using "make install" instead of "cmake --install"?
Offline
I'm using cmake --install, should I be trying to make this work with make install? I tried to copy what cJSON is doing for this project and it wouldn't work, although I admittedly didn't try very hard because I don't know if that's what you were asking me to try. I got as far as "make: *** No rule to make target 'install'. Stop." with make.
Offline
Just "make -C build DESTDIR="${pkgdir}" install" in the package() function doesn't work?
Offline
Ah I was missing the -C, that's my bad. This still generates *-targets.cmake files which have the build dir in them though...
Offline
"s/cmake --build build/make -C build/" - otherwise it might come w/ one of the cmake options, mainly "-D FETCHCONTENT_SOURCE_DIR_ZTD.CMAKE="$srcdir/ztd.cmake""?
Offline
Using make directly still gives the same issue with the *-targets.cmake files. Would it be absolutely awful to just find and replace with sed or whatever once it generates the *-targets.cmake files? I feel like there should be a legitimate cmake option to fix this though.
Offline
Which step actually generates those files/contents?
cmake, make or make install?
Then probably file a bug at https://github.com/soasis/idk/issues
Offline
I don't know for sure but I'd believe the make install step. I think cmake configure generates some template where relevant snippets are replaced by make install's install directory. From looking at it, it looks like pretty standard cmake so I'd be surprised if there wasn't a way to fix this without changing the cmake itself. For reference I believe this is the code which makes the templates:
export(TARGETS ztd.idk
FILE
"${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.idk/ztd.idk-targets.cmake"
)
Is there a way to tell make install to install "for" a specific installdir but to actually install "at" another dir? This just seems like too common of a pattern for there to not be some override.
Offline
It's gonna be the configure_package_config_file but idk where it's eg. getting ZTD_IDK_INCLUDE_DIRS from.
File an upsrteam bug, they'll hopefully know how they buildsystem is written/configured.
Offline