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

multiarc/7z failed to build on ARM 32-bit #2494

Open
spvkgn opened this issue Nov 5, 2024 · 2 comments
Open

multiarc/7z failed to build on ARM 32-bit #2494

spvkgn opened this issue Nov 5, 2024 · 2 comments

Comments

@spvkgn
Copy link
Contributor

spvkgn commented Nov 5, 2024

Details
FAILED: multiarc/CMakeFiles/multiarc.dir/src/formats/7z/C/SwapBytes.c.o 
/usr/bin/cc -DHAVE_LIBARCHIVE -DHAVE_PCRE -DHAVE_UNRAR -DRARDLL -D_7ZIP_PPMD_SUPPPORT -D_7ZIP_ST -Dmultiarc_EXPORTS -I"/<<PKGBUILDDIR>>/utils/include" -I"/<<PKGBUILDDIR>>/multiarc/src/formats/rar/unrar" -I"/<<PKGBUILDDIR>>/multiarc/src" -I"/<<PKGBUILDDIR>>/multiarc/src/libpcre" -I"/<<PKGBUILDDIR>>/multiarc/../WinPort" -I"/<<PKGBUILDDIR>>/multiarc/../far2l/far2sdk" -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -std=c99 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64 -ffunction-sections -fdata-sections -Wl,--gc-sections -DWINPORT_REGISTRY -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -std=c99 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64 -O2 -fPIC -fvisibility=hidden -MD -MT multiarc/CMakeFiles/multiarc.dir/src/formats/7z/C/SwapBytes.c.o -MF multiarc/CMakeFiles/multiarc.dir/src/formats/7z/C/SwapBytes.c.o.d -o multiarc/CMakeFiles/multiarc.dir/src/formats/7z/C/SwapBytes.c.o -c '/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c'
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c: In function ‘SwapBytes2_32’:
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:598:28: warning: implicit declaration of function ‘asm’ [-Wimplicit-function-declaration]
  598 |   #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
      |                            ^~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:618:5: note: in expansion of macro ‘SWAP2_32_VAR’
  618 |     SWAP2_32_VAR(v); \
      |     ^~~~~~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:628:5: note: in expansion of macro ‘SWAP2_32’
  628 |     SWAP2_32(0)  SWAP2_32(1)  items += 2 * 2;
      |     ^~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:598:47: error: expected ‘)’ before ‘:’ token
  598 |   #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
      |                                ~              ^
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:618:5: note: in expansion of macro ‘SWAP2_32_VAR’
  618 |     SWAP2_32_VAR(v); \
      |     ^~~~~~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:628:5: note: in expansion of macro ‘SWAP2_32’
  628 |     SWAP2_32(0)  SWAP2_32(1)  items += 2 * 2;
      |     ^~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:598:47: error: expected ‘)’ before ‘:’ token
  598 |   #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
      |                                ~              ^
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:618:5: note: in expansion of macro ‘SWAP2_32_VAR’
  618 |     SWAP2_32_VAR(v); \
      |     ^~~~~~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:628:18: note: in expansion of macro ‘SWAP2_32’
  628 |     SWAP2_32(0)  SWAP2_32(1)  items += 2 * 2;
      |                  ^~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:598:47: error: expected ‘)’ before ‘:’ token
  598 |   #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
      |                                ~              ^
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:618:5: note: in expansion of macro ‘SWAP2_32_VAR’
  618 |     SWAP2_32_VAR(v); \
      |     ^~~~~~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:629:5: note: in expansion of macro ‘SWAP2_32’
  629 |     SWAP2_32(0)  SWAP2_32(1)  items += 2 * 2;
      |     ^~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:598:47: error: expected ‘)’ before ‘:’ token
  598 |   #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
      |                                ~              ^
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:618:5: note: in expansion of macro ‘SWAP2_32_VAR’
  618 |     SWAP2_32_VAR(v); \
      |     ^~~~~~~~~~~~
/<<PKGBUILDDIR>>/multiarc/src/formats/7z/C/SwapBytes.c:629:18: note: in expansion of macro ‘SWAP2_32’
  629 |     SWAP2_32(0)  SWAP2_32(1)  items += 2 * 2;
      |                  ^~~~~~~~

https://launchpadlibrarian.net/757399390/buildlog_ubuntu-jammy-armhf.far2l_0+git20241103~ubuntu22.04.1_BUILDING.txt.gz

@spvkgn
Copy link
Contributor Author

spvkgn commented Nov 8, 2024

Без -std=c99 собирается нормально. Может нет смысла использовать -std для стороннего кода?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26e891a..9673ad5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -145,8 +145,8 @@ endif()
 
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64") #  -fsanitize=address
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64") #  -fsanitize=address
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+set(CMAKE_C_FLAGS_RELEASE "-O2")
 
 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
     set(APP_DIR ${CMAKE_BINARY_DIR}/install)
diff --git a/multiarc/CMakeLists.txt b/multiarc/CMakeLists.txt
index ad85f5b..cc15955 100644
--- a/multiarc/CMakeLists.txt
+++ b/multiarc/CMakeLists.txt
@@ -180,6 +180,8 @@ else()
     )
 endif()
 
+string(REPLACE "-std=c99" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+
 add_library (multiarc MODULE ${SOURCES})
 
 target_compile_definitions(multiarc PRIVATE -D_7ZIP_ST -D_7ZIP_PPMD_SUPPPORT)

@spvkgn
Copy link
Contributor Author

spvkgn commented Nov 10, 2024

diff --git a/multiarc/src/formats/7z/C/SwapBytes.c b/multiarc/src/formats/7z/C/SwapBytes.c
index 9290592..123a64b 100644
--- a/multiarc/src/formats/7z/C/SwapBytes.c
+++ b/multiarc/src/formats/7z/C/SwapBytes.c
@@ -506,8 +506,8 @@ void Z7_FASTCALL
     && (  (defined(__GNUC__) && (__GNUC__ >= 4)) \
        || (defined(__clang__) && (__clang_major__ >= 4)))
 
-  #define SWAP2_64_VAR(v)  asm ("rev16 %x0,%x0" : "+r" (v));
-  #define SWAP4_64_VAR(v)  asm ("rev32 %x0,%x0" : "+r" (v));
+  #define SWAP2_64_VAR(v)  __asm__ ("rev16 %x0,%x0" : "+r" (v));
+  #define SWAP4_64_VAR(v)  __asm__ ("rev32 %x0,%x0" : "+r" (v));
 
 #else  // is not ARM64-GNU
 
@@ -593,9 +593,9 @@ SwapBytes4_64(CSwapUInt32 *items, const CSwapUInt32 *lim)
        || (defined(__clang__) && (__clang_major__ >= 4)))
 
 #ifdef MY_CPU_64BIT
-  #define SWAP2_32_VAR(v)  asm ("rev16 %w0,%w0" : "+r" (v));
+  #define SWAP2_32_VAR(v)  __asm__ ("rev16 %w0,%w0" : "+r" (v));
 #else
-  #define SWAP2_32_VAR(v)  asm ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
+  #define SWAP2_32_VAR(v)  __asm__ ("rev16 %0,%0" : "+r" (v)); // for clang/gcc
     // asm ("rev16 %r0,%r0" : "+r" (a));  // for gcc
 #endif
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant