ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: "Ivan A. Melnikov" <iv@altlinux.org>
To: Motsyo Gennadi aka Drool <motsyo@gmail.com>, sisyphus@lists.altlinux.org
Subject: Re: [sisyphus] [howto] песочница в локальном hasher
Date: Thu, 17 Sep 2020 11:39:50 +0400
Message-ID: <20200917073950.mqfuu4nqti2hskkt@titan.localdomain> (raw)
In-Reply-To: <20200917072641.fhlnn3m72qptmklh@titan.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]

On Thu, Sep 17, 2020 at 11:26:41AM +0400, Ivan A. Melnikov wrote:
> On Thu, Sep 17, 2020 at 10:14:42AM +0300, Motsyo Gennadi aka Drool wrote:
> > 16.09.20 16:03, Ivan A. Melnikov пишет:
> > > -march=native causes the compiler to auto-detect the architecture of the
> > > build computer, то есть использовать всё, что компилятор видит
> > > в текущем процессоре.
> > > 
> > > Рекомендуется найти и обезвредить обоих.
> > 
> > 	В CMakeLists.txt используется конструкция
> > ARCH_FLAG "-march=${ARCH}"
> > 	Т.е. "native" ему передает сборочница? В предыдущих версиях эта
> > конструкция не использовалась, это нововведение. Кстати, разработчик
> > отозвался, пытается разобраться, и мне теперь есть что ему подсказать.
> 
> Нет, native это значение по умолчанию для ${ARCH}:
> 
> http://git.altlinux.org/gears/k/karbowanecwallet.git?a=blob;f=karbowanecwallet/CMakeLists.txt;h=ade77f6fec8fd12312e476387c3e27392e5bcc1a#l360
> 
> Наверное, это можно победить, передав CMake -DARCH=default. А вот
> -maes похоже можно только патчем выкосить.
> 

В первом приближении я бы сделал что-нибудь вроде приложенного,
чтобы не заморачиваться. Можно просить апстрим сделать опцию
не трогать флаги компилятора.

-- 
  wbr,
    iv m.

[-- Attachment #2: resprect-my-cflags.patch --]
[-- Type: text/x-patch, Size: 7366 bytes --]

diff --git a/cryptonote/CMakeLists.txt b/cryptonote/CMakeLists.txt
index f4454df..b76ee9c 100644
--- a/cryptonote/CMakeLists.txt
+++ b/cryptonote/CMakeLists.txt
@@ -51,12 +51,6 @@ if(ARCH_ID STREQUAL "ppc64le")
   set(PPC64LE 1)
 endif()
 
-if(WIN32 OR ARM)
-  set(OPT_FLAGS_RELEASE "-O2")
-else()
-  set(OPT_FLAGS_RELEASE "-Ofast")
-endif()
-
 # BUILD_TAG is used to select the build type to check for a new version
 if(BUILD_TAG)
   message(STATUS "Building build tag ${BUILD_TAG}")
@@ -65,9 +59,6 @@ else()
   message(STATUS "Building without build tag")
 endif()
 
-set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
-set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
-
 list(INSERT CMAKE_MODULE_PATH 0
   "${CMAKE_SOURCE_DIR}/cmake")
 
@@ -300,28 +291,6 @@ else()
   
   option(NO_AES "Explicitly disable AES support" ${NO_AES})
   
-  if(NOT NO_AES AND NOT ARM AND NOT PPC64LE)
-    message(STATUS "AES support enabled")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
-  elseif(PPC64LE)
-    message(STATUS "AES support not available on ppc64le")
-  elseif(ARM6)
-    message(STATUS "AES support not available on ARMv6")
-  elseif(ARM7)
-    message(STATUS "AES support not available on ARMv7")
-  elseif(ARM8)
-    CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
-    if(ARCH_PLUS_CRYPTO)
-      message(STATUS "Crypto extensions enabled for ARMv8")
-      set(ARCH_FLAG "-march=${ARCH}+crypto")
-    else()
-      message(STATUS "Crypto extensions unavailable on your ARMv8 device")
-    endif()
-  else()
-    message(STATUS "AES support disabled")
-  endif()
-  
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${PIC_FLAG}")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${PIC_FLAG}")
 
diff --git a/karbowanecwallet/CMakeLists.txt b/karbowanecwallet/CMakeLists.txt
index ade77f6..de68e3a 100644
--- a/karbowanecwallet/CMakeLists.txt
+++ b/karbowanecwallet/CMakeLists.txt
@@ -357,119 +357,8 @@ elseif (UNIX)
     endif()
     list(REMOVE_ITEM HEADERS ${CMAKE_SOURCE_DIR}/src/gui/macdockiconhandler.h)
 
-    set(ARCH native CACHE STRING "CPU to build for: -march value or default to not pass -march at all")
-    message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
-    if ("${ARCH}" STREQUAL "default")
-      set(ARCH_FLAG "")
-    elseif(PPC64LE)
-      set(ARCH_FLAG "-mcpu=${ARCH}")
-    else()
-      set(ARCH_FLAG "-march=${ARCH}")
-    endif()
-
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE")
-
-    if (NOT ARM AND NOT PPC64LE)
-      message(STATUS "AES support enabled")
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
-    elseif (PPC64LE)
-      message(STATUS "AES support not available on ppc64le")
-    elseif (ARM6)
-      message(STATUS "AES support not available on ARMv6")
-    elseif (ARM7)
-      message(STATUS "AES support not available on ARMv7")
-    elseif (ARM8)
-      CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
-      if (ARCH_PLUS_CRYPTO)
-        message(STATUS "Crypto extensions enabled for ARMv8")
-        set(ARCH_FLAG "-march=${ARCH}+crypto")
-      else()
-        message(STATUS "Crypto extensions unavailable on your ARMv8 device")
-      endif()
-    else()
-      message(STATUS "AES support disabled")
-    endif()
-
-    # Compiled binary malfunctions due to aliasing (GCC 6.1+)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
-
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAG}")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAG}")
-
-    if (ARM)
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
-    endif()
-
-    if (ARM)
-      message(STATUS "Setting FPU Flags for ARM Processors")
-      # NB NEON hardware does not fully implement the IEEE 754 standard for floating-point arithmetic
-      # Need custom assembly code to take full advantage of NEON SIMD
-      #
-      # Cortex-A5/9  -mfpu=neon-fp16
-      # Cortex-A7/15 -mfpu=neon-vfpv4
-      # Cortex-A8    -mfpu=neon
-      # ARMv8        -FP and SIMD on by default for all ARM8v-A series, NO -mfpu setting needed
-      #
-      # For custom -mtune, processor IDs for ARMv8-A series:
-      # 0xd04 - Cortex-A35
-      # 0xd07 - Cortex-A57
-      # 0xd08 - Cortex-A72
-      # 0xd03 - Cortex-A73
-      if (NOT ARM8)
-        CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp3-d16 CXX_ACCEPTS_VFP3_D16)
-        CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp4 CXX_ACCEPTS_VFP4)
-        CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=hard CXX_ACCEPTS_MFLOAT_HARD)
-        CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=softfp CXX_ACCEPTS_MFLOAT_SOFTFP)
-      endif()
-      if (ARM8)
-        CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
-        CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-843419 CXX_ACCEPTS_MFIX_CORTEX_A53_843419)
-      endif()
-      if (ARM6)
-        message(STATUS "Selecting VFP for ARMv6")
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp")
-      endif()
-      if (ARM7)
-        if (CXX_ACCEPTS_VFP3_D16 AND NOT CXX_ACCEPTS_VFP4)
-          message(STATUS "Selecting VFP3 for ARMv7")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp3-d16")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp3-d16")
-        endif()
-        if (CXX_ACCEPTS_VFP4)
-          message(STATUS "Selecting VFP4 for ARMv7")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp4")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp4")
-        endif()
-        if (CXX_ACCEPTS_MFLOAT_HARD)
-          message(STATUS "Setting Hardware ABI for Floating Point")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard")
-        endif()
-        if (CXX_ACCEPTS_MFLOAT_SOFTFP AND NOT CXX_ACCEPTS_MFLOAT_HARD)
-          message(STATUS "Setting Software ABI for Floating Point")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp")
-        endif()
-      endif()
-      if (ARM8)
-        if (CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
-          message(STATUS "Enabling Cortex-A53 workaround 835769")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769")
-        endif()
-        if (CXX_ACCEPTS_MFIX_CORTEX_A53_843419)
-          message(STATUS "Enabling Cortex-A53 workaround 843419")
-          set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-843419")
-          set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-843419")
-        endif()
-      endif()
-    endif()
-
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE -fno-strict-aliasing")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE -fno-strict-aliasing")
   endif()
 endif ()
 

  reply	other threads:[~2020-09-17  7:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30 10:20 [sisyphus] Пакет в сборочнице собирается битый Motsyo Gennadi aka Drool
2020-08-30 10:30 ` alexei
2020-08-31 11:46 ` Sergey V Turchin
2020-08-31 16:24   ` Motsyo Gennadi aka Drool
2020-09-02  8:45     ` Sergey V Turchin
2020-09-03  5:00       ` Motsyo Gennadi aka Drool
2020-09-03  6:46         ` Sergey V Turchin
2020-09-03 14:46           ` Michael Shigorin
2020-09-03 15:21             ` Sergey V Turchin
2020-09-04  7:15               ` Sergey V Turchin
2020-09-05 18:43             ` Motsyo Gennadi aka Drool
2020-09-05 19:12               ` [sisyphus] [howto] песочница в локальном hasher Michael Shigorin
2020-09-05 20:55                 ` Motsyo Gennadi aka Drool
2020-09-14 13:32                   ` Michael Shigorin
2020-09-16 11:51                     ` Motsyo Gennadi aka Drool
2020-09-16 12:24                       ` alexei
2020-09-16 12:46                         ` Motsyo Gennadi aka Drool
2020-09-16 12:50                           ` Michael Shigorin
2020-09-16 12:59                             ` Motsyo Gennadi aka Drool
2020-09-16 13:03                           ` Ivan A. Melnikov
2020-09-16 15:57                             ` Michael Shigorin
2020-09-17  6:22                               ` Ivan A. Melnikov
2020-09-17  7:14                             ` Motsyo Gennadi aka Drool
2020-09-17  7:26                               ` Ivan A. Melnikov
2020-09-17  7:39                                 ` Ivan A. Melnikov [this message]
2020-09-17  8:13                                   ` Motsyo Gennadi aka Drool
2020-09-17  6:31               ` [sisyphus] Пакет в сборочнице собирается битый Sergey V Turchin
2020-09-17  6:51                 ` Motsyo Gennadi aka Drool
2020-09-04  7:21     ` [sisyphus] ExcludeArch vs ExclusiveArch (was: Пакет в сборочнице собирается битый) Sergey V Turchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200917073950.mqfuu4nqti2hskkt@titan.localdomain \
    --to=iv@altlinux.org \
    --cc=motsyo@gmail.com \
    --cc=sisyphus@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git