Source: zynaddsubfx
Version: 3.0.5-2
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

zynaddsubfx fails to cross build from source, because it tries to use
the fistpl assembler instruction on non-x86 and that makes compilation
fail. The cause is misdetection of the availability of the instruction.
zynaddsubfx checks for it by summoning "as", which is the right
assembler on unix for native compilation. When a user supplies a C++
compiler, this badly fails as is happening during cross compilation.

The attached patch changes the check to use try_compile, which uses the
very same compiler as is used for compiling the sources. That makes the
check reliable. Please consider applying it.

Please note that this patch won't make zynaddsubfx cross buildable. It
still runs some host arch tool much later during build. I haven't found
a solution for that. Please close this bug when just fixing the asm
check though. It is an incremental improvement that also helps other
platforms and distributions.

Helmut
--- zynaddsubfx-3.0.5.orig/src/CMakeLists.txt
+++ zynaddsubfx-3.0.5/src/CMakeLists.txt
@@ -63,9 +63,7 @@
 set(CMAKE_REQUIRED_FLAGS "")
 
 
-execute_process(COMMAND echo fistpl 0
-                COMMAND as -
-                ERROR_VARIABLE AVOID_ASM)
+try_compile(USE_ASM ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/check_asm.cpp)
 
 ######### Settings ###########
 # NOTE: These cache variables should normally not be changed in this
@@ -316,7 +314,7 @@
     add_definitions(--system-header-prefix="FL/")
 endif()
 
-if(NOT AVOID_ASM)
+if(USE_ASM)
 	message(STATUS "Compiling with x86 opcode support")
     add_definitions(-DASM_F2I_YES)
 endif()
--- /dev/null
+++ zynaddsubfx-3.0.5/src/check_asm.cpp
@@ -0,0 +1,5 @@
+int main()
+{
+	__asm__ __volatile__("fistpl 0");
+	return 0;
+}

Reply via email to