Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to build on arm64/armhf #5476

Closed
PandaJim opened this issue Nov 3, 2023 · 8 comments · Fixed by #5503 or #5541
Closed

Failed to build on arm64/armhf #5476

PandaJim opened this issue Nov 3, 2023 · 8 comments · Fixed by #5503 or #5541
Assignees
Labels
bug An error, undesired behaviour, or missed functionality

Comments

@PandaJim
Copy link

PandaJim commented Nov 3, 2023

Bug description

The new 3.4.0 release built successfully in Ubuntu 22.04/23.10 on X86_64, but failed in arm64 and armhf.

There's no apparent error output, except HAVE_MMX and HAVE_SSE/SSE2 test fail:

cd obj-aarch64-linux-gnu && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DFETCHCONTENT_FULLY_DISCONNECTED=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/aarch64-linux-gnu -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_LIBDIR=lib -Daudacity_conan_enabled=Off -Daudacity_has_networking=Off -Daudacity_has_vst3=Off -Daudacity_lib_preference=system -Daudacity_use_ffmpeg=loaded -DwxBUILD_TOOLKIT=gtk3 -DAUDACITY_BUILD_LEVEL=2 ..
-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
...
...
-- Looking for __atomic_fetch_add_4 in atomic
-- Looking for __atomic_fetch_add_4 in atomic - found
-- Performing Test HAVE_MMX
-- Performing Test HAVE_MMX - Failed
-- Performing Test HAVE_SSE
-- Performing Test HAVE_SSE - Failed
-- Performing Test HAVE_SSE2
-- Performing Test HAVE_SSE2 - Failed
-- Looking for 4 include files float.h, ..., string.h
-- Looking for 4 include files float.h, ..., string.h - found
...
...
...
[ 22%] Linking CXX static library liblibnyquist.a
cd /<<PKGBUILDDIR>>/obj-aarch64-linux-gnu/lib-src/libnyquist && /usr/bin/cmake -P CMakeFiles/libnyquist.dir/cmake_clean_target.cmake
cd /<<PKGBUILDDIR>>/obj-aarch64-linux-gnu/lib-src/libnyquist && /usr/bin/cmake -E cmake_link_script CMakeFiles/libnyquist.dir/link.txt --verbose=1
...
...
...
CMakeFiles/libnyquist.dir/nyquist/xlisp/xlsubr.c.o CMakeFiles/libnyquist.dir/nyquist/xlisp/xlsym.c.o CMakeFiles/libnyquist.dir/nyquist/xlisp/xlsys.c.o
/usr/bin/ranlib liblibnyquist.a
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-aarch64-linux-gnu'
[ 22%] Built target libnyquist
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-aarch64-linux-gnu'
make[1]: *** [Makefile:159: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>/obj-aarch64-linux-gnu'
dh_auto_build: error: cd obj-aarch64-linux-gnu && make -j4 "INSTALL=install --strip-program=true" VERBOSE=1 returned exit code 2
make: *** [debian/rules:50: binary-arch] Error 25
dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2023-11-03T07:19:36Z

Finished
--------

Full build log: https://launchpadlibrarian.net/695908254/buildlog_ubuntu-lunar-arm64.audacity_3.4.0-0build1~ubuntu23.04_BUILDING.txt.gz

And, the debian/rules:

#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Tell to use gcc 11 for Focal
#export CC=/usr/bin/gcc-11
#export CXX=/usr/bin/g++-11

CMAKE_FLAGS = \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-Daudacity_conan_enabled=Off \
	-Daudacity_has_networking=Off \
	-Daudacity_has_vst3=Off \
	-Daudacity_lib_preference=system \
	-Daudacity_use_ffmpeg=loaded \
	-DwxBUILD_TOOLKIT=gtk3 \
	$(NULL)

ifeq (,$(findstring ~,$(DEB_VERSION_UPSTREAM)))
# No ~ in upstream version. Assuming release version (i.e. not alhpa or beta version)
CMAKE_FLAGS += -DAUDACITY_BUILD_LEVEL=2
endif

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CROSS_CMAKE_FLAGS = -DIMAGE_COMPILER_EXECUTABLE=$(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE)/utils/image-compiler
endif

DISABLE_LIBRARIES = \
	-Daudacity_use_libflac=off \
	-Daudacity_use_libid3tag=off \
	-Daudacity_use_libmad=off \
	-Daudacity_use_libmpg123=off \
	-Daudacity_use_libogg=off \
	-Daudacity_use_libopus=on \
	-Daudacity_use_libvorbis=off \
	-Daudacity_use_lv2=off \
	-Daudacity_use_midi=off \
	-Daudacity_use_portsmf=off \
	-Daudacity_use_sbsms=on \
	-Daudacity_use_soundtouch=off \
	-Daudacity_use_twolame=off \
	-Daudacity_use_vamp=off \
	-Daudacity_use_wavpack=off \
	$(NULL)

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	rm -rf obj-$(DEB_BUILD_GNU_TYPE)
endif

override_dh_auto_configure:
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	cmake -B obj-$(DEB_BUILD_GNU_TYPE) -DCMAKE_VERBOSE_MAKEFILE=ON $(CMAKE_FLAGS) $(DISABLE_LIBRARIES)
	cmake --build obj-$(DEB_BUILD_GNU_TYPE) --target image-compiler
endif
	WX_CONFIG=/usr/lib/$(DEB_HOST_GNU_TYPE)/wx/config/gtk3-unicode-3.2 dh_auto_configure -- $(CMAKE_FLAGS) $(CROSS_CMAKE_FLAGS)

execute_after_dh_auto_install:
	# Don't package unnecessary copy of GPL
	rm debian/tmp/usr/share/doc/audacity/LICENSE.txt

Please help.

Steps to reproduce

pass

Expected behavior

pass

Actual behavior

No response

Audacity Version

latest stable version (from audacityteam.org/download)

Operating system

Linux

Additional context

No response

@PandaJim PandaJim added the bug An error, undesired behaviour, or missed functionality label Nov 3, 2023
@crsib
Copy link
Contributor

crsib commented Nov 3, 2023

The error is

/<<PKGBUILDDIR>>/libraries/lib-time-and-pitch/StaffPad/SimdTypes_neon.h: In constructor ‘staffpad::audio::simd::float_x4::float_x4(float, float, float, float)’:
/<<PKGBUILDDIR>>/libraries/lib-time-and-pitch/StaffPad/SimdTypes_neon.h:48:24: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘float32x4_t’ in assignment
   48 |     s = {v0, v1, v2, v3};

Generally, for GCC and Clang, you can always grep for error: to find the compilation or link errors.

@crsib crsib added this to the Audacity 3.4.1 milestone Nov 3, 2023
@crsib crsib linked a pull request Nov 6, 2023 that will close this issue
6 tasks
@crsib crsib self-assigned this Nov 6, 2023
@crsib crsib closed this as completed Nov 6, 2023
@jhonny-oliveira
Copy link

Hi!

armhf is still failing with:

/usr/lib/gcc/arm-linux-gnueabihf/13/include/arm_neon.h:9891:1: error: inlining failed in call to ‘always_inline’ ‘vzipq_f32’: target specific option mismatch 9891 | vzipq_f32 (float32x4_t __a, float32x4_t __b)

You can find the full build log here: https://launchpadlibrarian.net/696741054/buildlog_ubuntu-mantic-armhf.audacity_3.4.0+dfsg-1~xtradeb2_BUILDING.txt.gz

Cheers!

@crsib
Copy link
Contributor

crsib commented Nov 8, 2023

I can build on RPi 4 right now, I have no other way to check. It seems that one of the third-party libraries is not compatible with 32-bit ARM with NEON disabled.

Probably the easiest fix is to introduce the following patch

diff --git a/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h b/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
index 2e0f0fdee..c3e20acab 100644
--- a/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
+++ b/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
@@ -122,7 +122,7 @@ typedef __m128 v4sf;
 /*
   ARM NEON support macros
 */
-#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__arm__) || defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64))
+#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64))
 #  include <arm_neon.h>
 typedef float32x4_t v4sf;
 #  define SIMD_SZ 4

However, I have no way to test the results

@crsib
Copy link
Contributor

crsib commented Nov 8, 2023

And honestly, judging by the experience I had running Audacity on BCM2711 I am very skeptical that it will run fine on slower CPUs at all

@jhonny-oliveira
Copy link

I can build on RPi 4 right now, I have no other way to check. It seems that one of the third-party libraries is not compatible with 32-bit ARM with NEON disabled.

Probably the easiest fix is to introduce the following patch

diff --git a/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h b/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
index 2e0f0fdee..c3e20acab 100644
--- a/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
+++ b/libraries/lib-time-and-pitch/StaffPad/pffft/pfsimd_macros.h
@@ -122,7 +122,7 @@ typedef __m128 v4sf;
 /*
   ARM NEON support macros
 */
-#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__arm__) || defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64))
+#elif !defined(PFFFT_SIMD_DISABLE) && (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64))
 #  include <arm_neon.h>
 typedef float32x4_t v4sf;
 #  define SIMD_SZ 4

However, I have no way to test the results

@crsib
Thank you for the patch! It worked.

@crsib
Copy link
Contributor

crsib commented Nov 8, 2023

Does it run? I will apply it to the upstream if it works

@crsib crsib reopened this Nov 8, 2023
@crsib crsib modified the milestones: Audacity 3.4.1, Audacity 3.4.2 Nov 8, 2023
@jhonny-oliveira
Copy link

Does it run? I will apply it to the upstream if it works

I did not test the package, but now it builds successfully: https://launchpad.net/~xtradeb/+archive/ubuntu/apps/+sourcepub/15372736/+listing-archive-extra .

At the moment, I don't have any means to test amr64 or amrhf. Sorry!

@crsib
Copy link
Contributor

crsib commented Nov 8, 2023

Well, I will just apply the patch tomorrow than :-)

@crsib crsib mentioned this issue Nov 9, 2023
6 tasks
@crsib crsib linked a pull request Nov 9, 2023 that will close this issue
6 tasks
@crsib crsib closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, undesired behaviour, or missed functionality
Projects
Status: Done
3 participants