Xpano 0.11.0 + thank you

Wow, incredible program! Compiled easily on an M1 Pro, much faster and without the color problems of hugin.

I’d like to get this integrated with darktable via lua script - unless someone has started to do that?

3 Likes

Thank you! Great to hear it works on the Apple chip, I haven’t had the chance to test that before.

In case of the lua script, you’ll need to extend Xpano with cli… feel free to open an issue on github about it / let me know if you want to take a stab at the implementation. Otherwise I’ll take a look at it, shouldn’t be much work.

Welcome to the forum :slight_smile:

@sguyader @martbetz

I don’t have experience with pkgbuild, but checking the docs, you’ll likely need to follow this: VCS package guidelines - ArchWiki to cover the git submodules.

This looks fantastic!
Could someone make an AppImage for Linux (Ideally Debian compatible) :stuck_out_tongue: ?

Thanks for this link, I’m indeed struggling with the git modules. I’ll try to follow these tips.

Trying to create a PKGBUILD, I still fail with the submodules, because of incorrect paths.
Currently the PKGBUILD puts the submodule repos at the same level as the xpano repo, I don’t know how to make the script populate the repos in the expected xpano/external forlder.

Here’s the console output:

❯ makepkg
==> Creating the package xpano-git 0.12.0.r0.gc2fa1fe-1 (Thu 20 Apr 2023 08:15:33 AM AST)
==> Checking dependencies for execution...
==> Checking dependencies for compilation...
==> Get the sources...
  -> Update xpano git repository...
  -> Update alpaca git repository...
  -> Update imgui git repository...
  -> Update nativefiledialog-extended git...
  -> Update thread-pool repository git...
  -> Update Catch2 git repository...
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), 1.53 Kio | 1.53 Mio/s, done.
From https://github.com/catchorg/Catch2
 + d7813a13...791176e8 refs/pull/2675/merge -> refs/pull/2675/merge (forced update)
==> Validation of source files with md5sums...
    xpano ... Ignored
    alpaca ... Ignored
    imgui ... Ignored
    nativefiledialog-extended ... Ignore
    thread-pool ... Ignore
    Catch2 ... Ignored
==> Extracting the sources...
  -> Create a working copy of the xpano git repository...
Reset the 'makepkg' branch
  -> Creation of a working copy of the alpaca git repository...
Reset the 'makepkg' branch
  -> Create a working copy of the imgui git repository...
Reset the 'makepkg' branch
  -> Create a working copy of the nativefiledialog-extended git repository...
Reset the 'makepkg' branch
  -> Create a working copy of the thread-pool git repository...
Reset the 'makepkg' branch
  -> Create a working copy of the Catch2 git repository...
Reset the 'makepkg' branch
==> Launching prepare()...
fatal : the repository '/home/sguyader/Sources/p-ranav/alpaca.git' does not exist
fatal : cloning of '/home/sguyader/Sources/p-ranav/alpaca.git' in the submodule path '/home/sguyader/Sources/New Folder/src/xpano/external/alpaca' failed
Unable to clone 'external/alpaca'. Scheduled retry
fatal : repository '/home/sguyader/Sources/New Folder/imgui.git' does not exist
fatal : cloning of '/home/sguyader/Sources/New Folder/imgui.git' into sub-module path '/home/sguyader/Sources/New Folder/src/xpano/external/imgui' failed
Unable to clone 'external/imgui'. Retry planned
fatal : repository '/home/sguyader/Sources/btzy/nativefiledialog-extended.git' does not exist
fatal : cloning of '/home/sguyader/Sources/btzy/nativefiledialog-extended.git' in the submodule path '/home/sguyader/Sources/New Folder/src/xpano/external/nativefiledialog-extended' failed
Unable to clone 'external/nativefiledialog-extended'. Scheduled retry
fatal : the repository '/home/sguyader/Sources/New Folder/thread-pool.git' does not exist
fatal : cloning of '/home/sguyader/Sources/New Folder/thread-pool.git' in the submodule path '/home/sguyader/Sources/New Folder/src/xpano/external/thread-pool' failed
Unable to clone 'external/thread-pool'. Re-test planned
fatal : repository '/home/sguyader/Sources/p-ranav/alpaca.git' does not exist
fatal : cloning of '/home/sguyader/Sources/p-ranav/alpaca.git' in the submodule path '/home/sguyader/Sources/New Folder/src/xpano/external/alpaca' failed
Unable to clone 'external/alpaca' for the second time, abort
==> ERROR: An error occurred in prepare().
    Abort...

Here’s the current PKGBUILD:

# Maintainer: Sébastien Guyader <sguyader@gmail.com>

pkgname=xpano-git
pkgver=0.12.0.r0.gc2fa1fe
pkgrel=1
pkgdesc="Automated photo stitching tool, with focus on simplicity and ease of use"
arch=(x86_64)
url="https://github.com/krupkat/xpano"
license=(GPL-3.0)
depends=(gtk3 opencv sdl2 spdlog)
makedepends=(cmake git)
provides=(xpano)
conflicts=(xpano)
source=("xpano::git+https://github.com/krupkat/xpano.git"
		"alpaca::git+https://github.com/p-ranav/alpaca.git"
		"imgui::git+https://github.com/ocornut/imgui.git"
		"nativefiledialog-extended::git+https://github.com/btzy/nativefiledialog-extended.git"
		"thread-pool::git+https://github.com/bshoshany/thread-pool.git"
		"Catch2::git+https://github.com/catchorg/Catch2.git")
md5sums=("SKIP" "SKIP" "SKIP" "SKIP" "SKIP" "SKIP")

pkgver(){
	cd "${srcdir}/xpano"
	git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "${srcdir}/${pkgname%-git}"
		git submodule init
		git config submodule.alpaca/alpaca.url "$srcdir/${pkgname%-git}/external/alpaca"
		git config submodule.imgui/imgui.url "$srcdir/${pkgname%-git}/external/imgui"
		git config submodule.nativefiledialog-extended/nativefiledialog-extended.url "$srcdir/${pkgname%-git}/external/nativefiledialog-extended"
		git config submodule.thread-pool/thread-pool.url "$srcdir/${pkgname%-git}/external/thread-pool"
		git -c protocol.file.allow=always submodule update
		git clone https://github.com/catchorg/Catch2.git catch --depth 1 --branch v3.3.1
		cd catch
		cmake -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
		cmake --build build -j $(nproc) --target install
		cd ..
}

build() {
		cd "${srcdir}/${pkgname%-git}"
		cmake -B build \
			-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
			-DCMAKE_INSTALL_PREFIX=install \
			-DBUILD_TESTING=OFF \
			-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
			-DCatch2_DIR=../catch/install/lib/cmake/Catch2

		cmake --build build -j $(nproc) --target install
		cd build
		ctest
		cd ..
}

package() {
	cd $_pkgname
	install -D3755 ./install/bin/Xpano "$pkgdir/usr/bin/Xpano"
	install -Dm644 ./install/share/xpano "$pkgdir/usr/share/$_pkgname"
}

More or less exactly the same as my effort, and I have the same issue. Oddly enough, though, spdlog gives me greif as well — even when running this script, I keep getting ‘cannot resolve all dependencies’ (spdlog) for some unfatherable reason. :thinking:

I’m running on Manjaro.

I don’t think you want both the repos in the ‘source’ list and cloning them as submodules. See e.g. the libjxl PKGBUILD.

And don’t do the build in the ‘prepare’ step…

1 Like

Thanks a lot for the effort!

One more tip would be to remove the Catch2 git from your pkgbuild, Xpano can build without it. Or it could work adding it to the depends field if you want to build tests as well.

OpenCV is required at least 4.4.0, not sure about the other dependencies.

I saw here that the repo is both included in the source list and clones, that’s why I did it.

And that’s what they appear to do in the libjxl PKGBUILD too.

Good tip regarding Catch2. I installed catch2 from the Arch repo, and removed the cloning of Catch2 in the normal build script (based on build-ubuntu-22.sh) but building the tests failed, even if I point to the installed Catch2 directory (-DCatch2_DIR=/usr/lib/cmake/Catch2).
I don’t know if building the tests is important or not.

This should be the correct dependency: AUR (en) - catch2v3, specifying -DCatch2_DIR shouldn’t be needed then.

Running the tests would be a nice bonus, that should be in the check() phase. Not necessary in the first version though.

1 Like

Nope, there is no additional clone after linking the external repos in the libjxl PKGBUILD.

But packages in the clone command in my fist PKGBUILD wasn’t declared as a submodule.
For the submodules I didn’t add a clone command.

I think I made some progrees on the PKGBUILD, but there’s an error coming from at least one of the submodules, and I don’t know how to solve this:

==> Launching prepare()...
external/alpaca' submodule (/home/sguyader/Sources/p-ranav/alpaca.git) registered to the 'external/alpaca' path
external/imgui submodule (/home/sguyader/Sources/New Folder/imgui.git) registered to the 'external/imgui' path
external/nativefiledialog-extended' submodule (/home/sguyader/Sources/btzy/nativefiledialog-extended.git) registered to the 'external/nativefiledialog-extended' path
Submodule 'external/thread-pool' (/home/sguyader/Sources/New Folder/thread-pool.git) registered to path 'external/thread-pool
Cloning in '/home/sguyader/Sources/New Folder/src/xpano/external/alpaca'...
done.
Cloning in '/home/sguyader/Sources/New Folder/src/xpano/external/imgui'...
done.
Cloning in '/home/sguyader/Sources/New Folder/src/xpano/external/nativefiledialog-extended'...
done.
Cloning in '/home/sguyader/Sources/New Folder/src/xpano/external/thread-pool'...
done.
Submodule path 'external/alpaca': 'cdfa51069b4459451a332467d2502362e4857f8a' from
fatal : git upload-pack: not our ref db038fb941d09753ed4867b012616e1f31e23c84
fatal : remote error : upload-pack: not our ref db038fb941d09753ed4867b012616e1f31e23c84
fatal: Submodule path 'external/imgui' recovered, but it did not contain db038fb941d09753ed4867b012616e1f31e23c84. Direct recovery of this commit failed.
==> ERROR: An error occurred in prepare().
    Abort...

And here’s the current PKBUILD:

# Maintainer: Sébastien Guyader <sguyader@gmail.com>

pkgname=xpano-git
pkgver=0.12.0.r0.gc2fa1fe
pkgrel=1
pkgdesc="Automated photo stitching tool, with focus on simplicity and ease of use"
arch=(x86_64)
url="https://github.com/krupkat/xpano"
license=(GPL-3.0)
depends=('gtk3' 'opencv>=4.4.0' 'sdl2' 'spdlog' 'catch2v3')
makedepends=(cmake git)
provides=(xpano)
conflicts=(xpano)
source=("xpano::git+https://github.com/krupkat/xpano.git"
		"alpaca::git+https://github.com/p-ranav/alpaca.git"
		"imgui::git+https://github.com/ocornut/imgui.git"
		"nativefiledialog-extended::git+https://github.com/btzy/nativefiledialog-extended.git"
		"thread-pool::git+https://github.com/bshoshany/thread-pool.git")
md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')

pkgver(){
	cd "${srcdir}/xpano"
	git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	
		git -C xpano submodule init
		local _submodule
		for _submodule in alpaca imgui nativefiledialog-extended thread-pool
		do
			git -C xpano config --local submodule.external/${_submodule}.url "$srcdir/${_submodule}"
		done
		git -C xpano -c protocol.file.allow='always' submodule update
}

build() {
		cd "${srcdir}/${pkgname%-git}"
		cmake -B build \
			-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
			-DCMAKE_INSTALL_PREFIX=install \
			-DBUILD_TESTING=ON \
			-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF

		cmake --build build -j $(nproc) --target install
		cd build
		ctest
		cd ..
}

package() {
	cd $_pkgname
	install -D3755 ./install/bin/Xpano "$pkgdir/usr/bin/Xpano"
	install -Dm644 ./install/share/xpano "$pkgdir/usr/share/$_pkgname"
}

Use these in sources instead:

https://github.com/krupkat/imgui.git
https://github.com/krupkat/thread-pool.git
1 Like

That did the trick! Now the PKGBUILD builds xpano.
With catch2v3 installed on the system (and added as a dependency), the tests are executed.
The “Stitcher pipeline defaults” test still fails though:

20/54 Testing: Stitcher pipeline defaults
20/54 Test: Stitcher pipeline defaults
Command: "/home/sguyader/Sources/New Folder/src/xpano/build/tests/StitcherTest" "Stitcher pipeline defaults"
Directory: /home/sguyader/Sources/New Folder/src/xpano/build/tests
"Stitcher pipeline defaults" start time: Apr 21 08:27 AST
Output:
----------------------------------------------------------
Filters: "Stitcher pipeline defaults"
Randomness seeded to: 3546636929
[2023-04-21 08:27:30.528] [info] Loaded data/image00.jpg
[2023-04-21 08:27:30.528] [info] Size: 1024 x 768, Keypoints: 290
[2023-04-21 08:27:30.617] [info] Loaded data/image02.jpg
[2023-04-21 08:27:30.617] [info] Size: 1024 x 768, Keypoints: 1330
[2023-04-21 08:27:30.678] [info] Loaded data/image01.jpg
[2023-04-21 08:27:30.678] [info] Size: 1024 x 768, Keypoints: 2035
[2023-04-21 08:27:30.812] [info] Loaded data/image03.jpg
[2023-04-21 08:27:30.812] [info] Size: 1024 x 768, Keypoints: 2245
[2023-04-21 08:27:30.937] [info] Loaded data/image04.jpg
[2023-04-21 08:27:30.937] [info] Size: 1024 x 768, Keypoints: 2707
[2023-04-21 08:27:31.007] [info] Loaded data/image05.jpg
[2023-04-21 08:27:31.007] [info] Size: 1024 x 768, Keypoints: 2307
[2023-04-21 08:27:31.136] [info] Loaded data/image06.jpg
[2023-04-21 08:27:31.136] [info] Size: 768 x 1024, Keypoints: 1895
[2023-04-21 08:27:31.259] [info] Loaded data/image07.jpg
[2023-04-21 08:27:31.259] [info] Size: 768 x 1024, Keypoints: 2538
[2023-04-21 08:27:31.299] [info] Loaded data/image08.jpg
[2023-04-21 08:27:31.299] [info] Size: 768 x 1024, Keypoints: 1653
[2023-04-21 08:27:31.329] [info] Loaded data/image09.jpg
[2023-04-21 08:27:31.329] [info] Size: 1024 x 768, Keypoints: 212

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StitcherTest is a Catch2 v3.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
Stitcher pipeline defaults
-------------------------------------------------------------------------------
/home/sguyader/Sources/New Folder/src/xpano/tests/stitcher_pipeline_test.cc:29
...............................................................................

/home/sguyader/Sources/New Folder/src/xpano/tests/stitcher_pipeline_test.cc:59: FAILED:
  CHECK_THAT( stitch_result.pano->cols, WithinRel(2651, eps) )
with expansion:
  2678 (0xa76) and 2651 are within 1% of each other

===============================================================================
test cases:  1 |  0 passed | 1 failed
assertions: 18 | 17 passed | 1 failed

<end of output>
Test time =   5.69 sec
----------------------------------------------------------
Test Failed.
"Stitcher pipeline defaults" end time: Apr 21 08:27 AST
"Stitcher pipeline defaults" time elapsed: 00:00:05
----------------------------------------------------------

I’ve rerun the failed test directly in the build directory, and strangely it passed successfuly:

❯ ctest --rerun-failed --output-on-failure
Test project /home/sguyader/Sources/New Folder/src/xpano/build
    Start 20: Stitcher pipeline defaults
1/1 Test #20: Stitcher pipeline defaults .......   Passed    5.25 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   5.25 sec

In general, I don’t think you don’t want to build w/ tests (and run them) when packaging, but hat’s just my preference…

If you still want to build w/ tests, the ctest ... is better moved to the check() section of PKGBUILD (between build() and package()).

Thanks. I’m indeed planning to move the tests in the check().
If you have more experience with packaging, would you like to take over adapting/maintaining this PKGBUILD? It’s the first time I try making one, you seem more knowledgeable than I am.