Subject: megasdk and megacmd

From: ruivlea <[email-masked]>
Date: Sun, 11 May 2025 16:00:57 +0000

Hello,

megasdk and megacmd aports are not updated since 2023. Is there any plan to update them to latest version?

---

From: ruivlea <[email-masked]>
Date: Mon, 19 May 2025 07:14:36 +0000

community/megasdk need upgrade. I tried to build megasdk 9.4.0 but failed.

APKBUILD modified from version 4.17.1d-r1:
---
# Contributor: Jakub Jirutka <[email-masked]>
# Maintainer: Jakub Jirutka <[email-masked]>
pkgname=megasdk
# NOTE: It's usually needed to also bump the megacmd aport.
pkgver=9.4.0
pkgrel=0
pkgdesc="MEGA C++ SDK"
url="https://github.com/meganz/sdk"
# s390x: tests fail
# x86: blocked by crypto++-dev
arch="all !s390x !x86"
license="BSD-2-Clause"
depends_dev="
	c-ares-dev
	crypto++-dev
	curl-dev
	icu-dev
	libsodium-dev
	sqlite-dev
	"
makedepends="
	$depends_dev
	cmake
	samurai
	linux-headers
	openssl-dev
	"
checkdepends="
	gtest-dev
	"
subpackages="$pkgname-dev"
source="https://github.com/meganz/sdk/archive/refs/tags/v$pkgver/megasdk-$pkgver.tar.gz
	fix-null-to-bool-cast.patch
	"

builddir="$srcdir/sdk-$pkgver"

prepare() {
	default_prepare

	sed -i '/IMPORTED_TARGET libcrypto++/s/++/pp/' cmake/modules/sdklib_libraries.cmake
}

build() {
	# FIXME: the test suite crashes on a libstdc++ assertion. this means something is broken!
	cmake -B build -G Ninja \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS -flto=auto" \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DCMAKE_INSTALL_MANDIR=/usr/share/man \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
		-DBUILD_SHARED_LIBS=ON \
		-DENABLE_CHAT=OFF \
		-DENABLE_SDKLIB_EXAMPLES=OFF \
		-DENABLE_SDKLIB_TESTS=ON \
		-DUSE_FREEIMAGE=OFF \
		-DUSE_PDFIUM=OFF \
		-DUSE_MEDIAINFO=OFF \
		-DUSE_FFMPEG=OFF

	# build with half threads to avoid lag
	cmake --build build -j $(($(nproc)/2))
}

check() {
	./tests/test_unit
}

package() {
	# No install task for cmake.
	install -Dm755 build/libSDKlib.so.$pkgver "$pkgdir"/usr/lib/libSDKlib.so.$pkgver
	ln -s libSDKlib.so.$pkgver "$pkgdir"/usr/lib/libSDKlib.so
	
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
592b715b6fb651213bb01e57cf629798d6fbad4041be76894d205ab09e88a206c3bfac98a5132ce2e92cc7285242e27f76d5d728684eaeee02b0406b87bd1af4  megasdk-9.4.0.tar.gz
62bd518dbd01541f4300c887491d9d00ee03d0ee9b19d3d8ab419c8bce401999c98677e591c53acedc4a4fe0d90f4125a69ac0396c0dbb2dc250c2fedaec7720  fix-null-to-bool-cast.patch
"
---

Error is:
---
aports/community/megasdk/src/sdk-9.4.0/src/megaclient.cpp: In member function 'pw_key':
aports/community/megasdk/src/sdk-9.4.0/src/megaclient.cpp:10094:61: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
10094 |     SymmCipher* keys = new SymmCipher[static_cast<size_t>(n)];
      |                                                             ^
/usr/include/c++/14.2.0/new:133:26: note: in a call to allocation function 'operator new []' declared here
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^
/usr/include/fortify/stdio.h: In function '__to_xstring.constprop':
/usr/include/fortify/stdio.h:73: error: inlining failed in call to 'always_inline' 'vsnprintf': function body can be overwritten at link time
   73 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
/usr/include/c++/14.2.0/ext/string_conversions.h:113:32: note: called from here
  113 |       const int __len = __convf(__s, __n, __fmt, __args);