Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] monero fails to execute (Illegal instruction)
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Fri Aug 13, 2021 10:05 pm    Post subject: [SOLVED] monero fails to execute (Illegal instruction) Reply with quote

Hi,
I'm having issue with net-p2p/monero. I opened a bug here if you want the long version : https://github.com/gentoo-monero/gentoo-monero/issues/18
Otherwise, tldr :

When I build the package inside a core2 chroot on my amd system, the binary cannot be executed on my core2 laptop (Illegal instruction)
But if I compile directly the package on the core2 laptop, then it works fine.

I suspect that when the package is built inside the chroot, it somehow picks up the AES instruction from my amd cpu, which could explain the illegal instruction I think.

My chrooted core2 install make.conf is :

Code:
CHOST="x86_64-pc-linux-gnu"
COMMON_FLAGS="-march=core2 -O2 -pipe"
#COMMON_FLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3"


As you can see, the CPU_FLAGS is correctly set so I really wonder why, when built inside the core2 chroot, it would include aes (Just a guess, as I'm not 100% sure), I've been using this chroot to build my packages for my old laptop for 2 years now and this is the first time I'm having such strange issue.

The monero ebuild is here : https://github.com/gentoo-monero/gentoo-monero/blob/master/net-p2p/monero/monero-0.17.2.0.ebuild

Any help appreciated !

Thanks


Last edited by sdauth on Sat Aug 14, 2021 4:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Fri Aug 13, 2021 10:41 pm    Post subject: Reply with quote

First off the CPU_FLAGS_X86 if not in ebuild, are usually ignored, but this isn't what you're seeing.

It's quite possible that the build system of the underlying package simply ignores CFLAGs passed to it and makes its own. A copy of the build log, if it doesn't truncate it, would be interesting.
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Fri Aug 13, 2021 10:59 pm    Post subject: Reply with quote

I build pkgs for my acer laptop (i3) on my ryzen machine, and use this setting

Code:
CFLAGS="-march=skylake -O2 -pipe -mtune=skylake -mno-sse4a -mno-sha -mno-sgx -mno-wbnoinvd -mno-clwb -mno-mwaitx -mno-clzero -mno-rdpid -mno-rtm -mno-hle"


The flags I have shut off are not common to both processors, ie either intel only flags or ryzen only flags.
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Fri Aug 13, 2021 11:34 pm    Post subject: Reply with quote

eccerr0r wrote:
A copy of the build log, if it doesn't truncate it, would be interesting.


monero-0.17.2.0-core2 (laptop build)

monero-0.17.2.0-core2-chroot (chroot build)

I don't see anything relevant / helpful though.

Anon-E-moose wrote:
I build pkgs for my acer laptop (i3) on my ryzen machine, and use this setting

Code:
CFLAGS="-march=skylake -O2 -pipe -mtune=skylake -mno-sse4a -mno-sha -mno-sgx -mno-wbnoinvd -mno-clwb -mno-mwaitx -mno-clzero -mno-rdpid -mno-rtm -mno-hle"


The flags I have shut off are not common to both processors, ie either intel only flags or ryzen only flags.


Interesting, so does it mean I should add -mno-aes in the intel core2 chroot ? To make sure it ignores entirely aes I mean. (edit : currently compiling, will report if it worked in a few minutes)
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Fri Aug 13, 2021 11:44 pm    Post subject: Reply with quote

By rights, it shouldn't be trying to use the aes instruction when using a particular march= that doesn't have it native, but I've seen funny behavior when I don't explicitly turn off flag(s).

Edit to add:
You could run this to see what the differences are

diff -U0 <(LANG=C gcc -Q -O2 -march=skylake --help=target) <(LANG=C gcc -Q -O2 -march=znver2 --help=target)

change skylake and znver2 as appropriate.
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW


Last edited by Anon-E-moose on Fri Aug 13, 2021 11:49 pm; edited 2 times in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Fri Aug 13, 2021 11:46 pm    Post subject: Reply with quote

cmake wrote:
Code:
-- Performing Test _maes_cxx
-- Performing Test _maes_cxx - Success
-- Setting CXX flag -maes
-- Performing Test _maes_c
-- Performing Test _maes_c - Success
-- Setting C flag -maes
-- Performing Test HAVE_SSSE3

says a lot... So yes you'll have to hack the downstream build system or use distcc.
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 18856

PostPosted: Fri Aug 13, 2021 11:46 pm    Post subject: Reply with quote

From the chroot build log:
Code:
-- Performing Test _maes_cxx
-- Performing Test _maes_cxx - Success
-- Setting CXX flag -maes
Code:
C++             -march=core2 -O2 -pipe -pthread -maes -march=native -fno-strict-aliasing -std=c++11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Wno-reorder -Wno-missing-field-initializers  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing -ftemplate-depth=900
So it looks like a CMake test is auto-detecting AES support and enabling it. This seems like a bug to me. If the build system is not specifically instructed to auto-detect and automagically enable features, then it shouldn't do that.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Fri Aug 13, 2021 11:48 pm    Post subject: Reply with quote

dammit just noticed that even the local build says "aes detected" which is very odd... unless the build logs were crossed...
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Sat Aug 14, 2021 12:14 am    Post subject: Reply with quote

I tried to set :

Code:
CFLAGS="${COMMON_FLAGS} -mno-aes"
CXXFLAGS="${CFLAGS}"


in package.env

And unfortunately it doesn't work. -maes gets enabled by cmake configure, so it looks like a monero bug, not ebuild issue after all. As Hu said.

Code:
-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -march=core2 -O2 -pipe -mno-aes -pthread -maes -march=native -fno-strict-aliasing -std=c11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing
C++             -march=core2 -O2 -pipe -mno-aes -pthread -maes -march=native -fno-strict-aliasing -std=c++11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Wno-reorder -Wno-missing-field-initializers  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing -ftemplate-depth=900
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed


See, -maes is enabled no matter what. Strangely, when building directly on the core2 laptop, aes is "enabled" as you can see in the log but it doesn't cause any issue with the executable.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 12:35 am    Post subject: Reply with quote

I'd probably patch CMakeLists.txt to remove these

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)

as they are adding to the flags you already supply.
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 18856

PostPosted: Sat Aug 14, 2021 12:51 am    Post subject: Reply with quote

Perhaps -maes is not the problem? OP: what illegal instruction is used that causes the failure?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 12:54 am    Post subject: Reply with quote

Hu wrote:
Perhaps -maes is not the problem? OP: what illegal instruction is used that causes the failure?


The problem is the calls to CheckC* which do this
Code:
-march=core2 -O2 -pipe -mno-aes -pthread -maes -march=native

_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 1:01 am    Post subject: Reply with quote

The -march=native in any case must be removed regardless of what's going on with -maes. I suspect that solving the removal of -march=native will also remove -maes.
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Sat Aug 14, 2021 1:42 am    Post subject: Reply with quote

Hu wrote:
Perhaps -maes is not the problem? OP: what illegal instruction is used that causes the failure?


With gdb (which I'm not expert with) and monero compiled with debug (CFLAGS="${COMMON_FLAGS} -ggdb")

Code:
$ gdb monerod
run

0x0000555555891a6a in _GLOBAL__sub_I_crypto.cpp ()


and that's it. :o

@Anon-E-moose and @eccerr0r :

I will try that later, it's a bit late over here. Thanks for the suggestion and your help ! Appreciated
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 1:49 am    Post subject: Reply with quote

Well, I guess it doesn't really matter what the faulting instruction is. With -march=native on a computer compiling that's not of the same architecture, it can generate bad instructions regardless if -maes is also put there.

I wouldn't be surprised if it put in aes instructions as it's probably doing encryption of sorts.
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 10:29 am    Post subject: Reply with quote

Anon-E-moose wrote:
I'd probably patch CMakeLists.txt to remove these

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLinkerFlag)

as they are adding to the flags you already supply.


Actually you will need to do more than just block those, those are setting up to be called later.
CMakeLists.txt
Code:
/tmp/monero-gui-0.17.2.0 $ grep -r _flag
src/qt/FutureScheduler.cpp:    static std::once_flag once;
CMakeLists.txt:add_c_flag_if_supported(-Werror C_SECURITY_FLAGS)
CMakeLists.txt:add_cxx_flag_if_supported(-Werror CXX_SECURITY_FLAGS)
CMakeLists.txt:add_c_flag_if_supported(-Wformat C_SECURITY_FLAGS)
CMakeLists.txt:add_cxx_flag_if_supported(-Wformat CXX_SECURITY_FLAGS)
CMakeLists.txt:add_c_flag_if_supported(-Wformat-security C_SECURITY_FLAGS)
CMakeLists.txt:add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
CMakeLists.txt:  add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
CMakeLists.txt:  add_cxx_flag_if_supported(-fstack-protector-strong CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
CMakeLists.txt:  add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
CMakeLists.txt:  add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
CMakeLists.txt:  add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,-bind_at_load LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS)
CMakeLists.txt:add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
CMakeLists.txt:add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)
CMakeLists.txt:add_linker_flag_if_supported(-Wl,-z,noexecstack noexecstack_SUPPORTED)
CMakeLists.txt:add_linker_flag_if_supported(-Wl,-z,noexecheap noexecheap_SUPPORTED)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,--dynamicbase LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,--nxcompat LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-Wl,--high-entropy-va LD_SECURITY_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-static-libgcc STATIC_FLAGS)
CMakeLists.txt:  add_linker_flag_if_supported(-static-libstdc++ STATIC_FLAGS)
CMakeLists.txt:    add_linker_flag_if_supported(-static STATIC_FLAGS)
CMakeLists.txt:add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS)
CMakeLists.txt:add_cxx_flag_if_supported(-fno-strict-aliasing CXX_SECURITY_FLAGS)
CMakeLists.txt:add_c_flag_if_supported(-fPIC C_SECURITY_FLAGS)
CMakeLists.txt:add_cxx_flag_if_supported(-fPIC CXX_SECURITY_FLAGS)


I don't see the native or aes, so it's probably a by-product of the above.

None the less, when CFLAGS are passed to cmake it should not try and determine anything past that point concerning cflags.

Edit to add: Looking at a variety of things (I'm far from a cmake expert) but it looks like you need to tell cmake you're cross compiling, that should shut off generation of march=native and associated problems, but I'm not sure how to do it.
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 1:43 pm    Post subject: Reply with quote

Again I'm just a cmake n00b but my current guess if you apply this patch to the ebuild:
Code:
--- monero-0.17.2.0.ebuild.old   2021-08-14 07:51:20.920625609 -0600
+++ monero-0.17.2.0.ebuild   2021-08-14 07:51:43.620625493 -0600
@@ -72,6 +72,7 @@
       # The user can decide for themselves if they want to use ccache.
       -DUSE_CCACHE=OFF
       -DUSE_DEVICE_TREZOR=$(usex hw-wallet)
+      -DARCH=default
    )
 
    cmake_src_configure

it *might* do what you want. I can't test this and it's only a guess so you'll only know if it works if you try it :D ...
Something like this is only for monero due to how they coded their current CMakeLists.txt so if someone searches this thread, no this is not a magic panacea.

Note: I don't think -D NO_AES=1 is also needed but you're welcome to try. All you need is to set ARCH=default as far as I can tell.
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 2:03 pm    Post subject: Reply with quote

Good find

Quote:
Build Optimization

The CMake build system will, by default, create optimized native builds for your particular system type when you build the software. Using this method, the binaries created provide a better experience and all together faster performance.

However, if you wish to create portable binaries that can be shared between systems, specify -DARCH=default in your CMake arguments during the build process. Note that portable binaries will have a noticable difference in performance than native binaries. For this reason, it is always best to build for your particuar system if possible.

_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Sat Aug 14, 2021 4:58 pm    Post subject: Reply with quote

eccerr0r wrote:
Again I'm just a cmake n00b but my current guess if you apply this patch to the ebuild:
Code:
--- monero-0.17.2.0.ebuild.old   2021-08-14 07:51:20.920625609 -0600
+++ monero-0.17.2.0.ebuild   2021-08-14 07:51:43.620625493 -0600
@@ -72,6 +72,7 @@
       # The user can decide for themselves if they want to use ccache.
       -DUSE_CCACHE=OFF
       -DUSE_DEVICE_TREZOR=$(usex hw-wallet)
+      -DARCH=default
    )
 
    cmake_src_configure

it *might* do what you want. I can't test this and it's only a guess so you'll only know if it works if you try it :D ...
Something like this is only for monero due to how they coded their current CMakeLists.txt so if someone searches this thread, no this is not a magic panacea.

Note: I don't think -D NO_AES=1 is also needed but you're welcome to try. All you need is to set ARCH=default as far as I can tell.


Brilliant ! 100% working !
Also, -DNO_AES is not needed, it just work 8)

With -DARCH=default, no more redudancy of -march=core2 & -march=native as you can see here :

Code:
-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -march=core2 -O2 -pipe -pthread -maes  -fno-strict-aliasing -std=c11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing
C++             -march=core2 -O2 -pipe -pthread -maes  -fno-strict-aliasing -std=c++11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Wno-reorder -Wno-missing-field-initializers  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing -ftemplate-depth=900
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed

-- Configuring done


Now I wonder if it can be added to the gentoo monero overlay, I'll leave a comment there. Otherwise, I can of course copy the ebuild with that minor change to my localrepo, no big deal. Thank you !
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 5:06 pm    Post subject: Reply with quote

You could add it to the ebuild, but I'd do it by way of adding a USE flag so that it could be turned on and off without re-digesting the ebuild.
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 6:02 pm    Post subject: Reply with quote

I still see -maes which could be a problem, that looks weird... does it work even with -maes added?
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 5719
Location: Dallas area

PostPosted: Sat Aug 14, 2021 6:14 pm    Post subject: Reply with quote

eccerr0r wrote:
I still see -maes which could be a problem, that looks weird... does it work even with -maes added?


I believe cmake runs a little program to test it and makes it's decision on that.

But I'd be curious to see what the flags (cmake generated) are on the target system
_________________
PRIME x570-pro, 3700x, 5.17 zen kernel
gcc 9.3.0/11.2.0, profile 17.1 amd64-no-multilib, openrc, wayland

copy of my local repo
---
The New OTW
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 7:14 pm    Post subject: Reply with quote

correct, -DNO_AES=1 should disable the test and also -maes, but thought that ARCH=default should also automatically disable the test and -maes... apparently I was wrong, else something doesn't quite make sense here...
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
sdauth
Guru
Guru


Joined: 19 Sep 2018
Posts: 397
Location: Ásgarðr

PostPosted: Sat Aug 14, 2021 7:43 pm    Post subject: Reply with quote

eccerr0r wrote:
I still see -maes which could be a problem, that looks weird... does it work even with -maes added?

yes, it works, i'm currently resynchronizing the blockchain, I'm looking at monerod log and nothing wrong

I haven't tried to explicitly disable aes with -DNO_AES yet (I only tested to see what flags were generated but interrupted the build since I need cpu power atm) since it worked without it.

Without -DNO_AES :

Code:
-- Performing Test _maes_cxx
-- Performing Test _maes_cxx - Success
-- Setting CXX flag -maes
-- Performing Test _maes_c
-- Performing Test _maes_c - Success
-- Setting C flag -maes
-- Performing Test HAVE_SSSE3
-- Performing Test HAVE_SSSE3 - Success
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- Performing Test HAVE_CXX_ATOMICS
-- Performing Test HAVE_CXX_ATOMICS - Success
-- Could not find HIDAPI
-- Trezor support disabled by USE_DEVICE_TREZOR
-- Building on x86_64 for default
-- AES support enabled
-- Performing Test _Wformat_c
-- Performing Test _Wformat_c - Success
-- Performing Test _Wformat_cxx
-- Performing Test _Wformat_cxx - Success
-- Performing Test _Wformat_security_c
-- Performing Test _Wformat_security_c - Success
-- Performing Test _Wformat_security_cxx
-- Performing Test _Wformat_security_cxx - Success
-- Performing Test _fstack_protector_c
-- Performing Test _fstack_protector_c - Success
-- Performing Test _fstack_protector_cxx
-- Performing Test _fstack_protector_cxx - Success
-- Performing Test _fstack_protector_strong_c
-- Performing Test _fstack_protector_strong_c - Success
-- Performing Test _fstack_protector_strong_cxx
-- Performing Test _fstack_protector_strong_cxx - Success
-- Performing Test _fcf_protection=full_c
-- Performing Test _fcf_protection=full_c - Success
-- Performing Test _fcf_protection=full_cxx
-- Performing Test _fcf_protection=full_cxx - Success
-- Performing Test _fstack_clash_protection_c
-- Performing Test _fstack_clash_protection_c - Success
-- Performing Test _fstack_clash_protection_cxx
-- Performing Test _fstack_clash_protection_cxx - Success
-- Looking for -pie linker flag
-- Looking for -pie linker flag - found
-- Looking for -Wl,-z,relro linker flag
-- Looking for -Wl,-z,relro linker flag - found
-- Looking for -Wl,-z,now linker flag
-- Looking for -Wl,-z,now linker flag - found
-- Looking for -Wl,-z,noexecstack linker flag
-- Looking for -Wl,-z,noexecstack linker flag - found
-- Looking for -Wl,-z,noexecheap linker flag
-- Looking for -Wl,-z,noexecheap linker flag - not found
-- Using C security hardening flags:  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
-- Using C++ security hardening flags:  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
-- Using linker security hardening flags:  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
-- Found Boost Version: 107600
-- Looking for rl_copy_text
-- Looking for rl_copy_text - found
-- Looking for rl_filename_completion_function
-- Looking for rl_filename_completion_function - found
-- Found readline library at: /usr
Wallet crypto is using amd64-64-24k backend
CMake Deprecation Warning at src/p2p/CMakeLists.txt:29 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at src/cryptonote_protocol/CMakeLists.txt:29 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Trezor support disabled
-- Not building tests
-- Not building debug utilities
-- Performing Test HAVE_C11
-- Performing Test HAVE_C11 - Success
-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -march=core2 -O2 -pipe -pthread -maes  -fno-strict-aliasing -std=c11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing
C++             -march=core2 -O2 -pipe -pthread -maes  -fno-strict-aliasing -std=c++11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Wno-reorder -Wno-missing-field-initializers  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing -ftemplate-depth=900
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed

-- Configuring done


If I add -DNO_AES=ON, then it warns that AES is disabled (AES support explicitly disabled) but still test for it ! Even when building directly on the laptop lacking aes instruction, it tests for and sets -maes anyway lol.. really strange to say the least.

Code:
-- Performing Test _maes_cxx
-- Performing Test _maes_cxx - Success
-- Setting CXX flag -maes
-- Performing Test _maes_c
-- Performing Test _maes_c - Success
-- Setting C flag -maes
-- Performing Test HAVE_SSSE3
-- Performing Test HAVE_SSSE3 - Success
-- Performing Test HAVE_AVX2
-- Performing Test HAVE_AVX2 - Success
-- Performing Test HAVE_CXX_ATOMICS
-- Performing Test HAVE_CXX_ATOMICS - Success
-- Could not find HIDAPI
-- Trezor support disabled by USE_DEVICE_TREZOR
-- Building on x86_64 for default
-- AES support explicitly disabled
-- Performing Test _Wformat_c
-- Performing Test _Wformat_c - Success
-- Performing Test _Wformat_cxx
-- Performing Test _Wformat_cxx - Success
-- Performing Test _Wformat_security_c
-- Performing Test _Wformat_security_c - Success
-- Performing Test _Wformat_security_cxx
-- Performing Test _Wformat_security_cxx - Success
-- Performing Test _fstack_protector_c
-- Performing Test _fstack_protector_c - Success
-- Performing Test _fstack_protector_cxx
-- Performing Test _fstack_protector_cxx - Success
-- Performing Test _fstack_protector_strong_c
-- Performing Test _fstack_protector_strong_c - Success
-- Performing Test _fstack_protector_strong_cxx
-- Performing Test _fstack_protector_strong_cxx - Success
-- Performing Test _fcf_protection=full_c
-- Performing Test _fcf_protection=full_c - Success
-- Performing Test _fcf_protection=full_cxx
-- Performing Test _fcf_protection=full_cxx - Success
-- Performing Test _fstack_clash_protection_c
-- Performing Test _fstack_clash_protection_c - Success
-- Performing Test _fstack_clash_protection_cxx
-- Performing Test _fstack_clash_protection_cxx - Success
-- Looking for -pie linker flag
-- Looking for -pie linker flag - found
-- Looking for -Wl,-z,relro linker flag
-- Looking for -Wl,-z,relro linker flag - found
-- Looking for -Wl,-z,now linker flag
-- Looking for -Wl,-z,now linker flag - found
-- Looking for -Wl,-z,noexecstack linker flag
-- Looking for -Wl,-z,noexecstack linker flag - found
-- Looking for -Wl,-z,noexecheap linker flag
-- Looking for -Wl,-z,noexecheap linker flag - not found
-- Using C security hardening flags:  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
-- Using C++ security hardening flags:  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
-- Using linker security hardening flags:  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
-- Found Boost Version: 107600
-- Looking for rl_copy_text
-- Looking for rl_copy_text - found
-- Looking for rl_filename_completion_function
-- Looking for rl_filename_completion_function - found
-- Found readline library at: /usr
Wallet crypto is using amd64-64-24k backend
CMake Deprecation Warning at src/p2p/CMakeLists.txt:29 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at src/cryptonote_protocol/CMakeLists.txt:29 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Trezor support disabled
-- Not building tests
-- Not building debug utilities
-- Performing Test HAVE_C11
-- Performing Test HAVE_C11 - Success
-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -march=core2 -O2 -pipe -pthread -DNO_AES  -fno-strict-aliasing -std=c11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing
C++             -march=core2 -O2 -pipe -pthread -DNO_AES  -fno-strict-aliasing -std=c++11 -D_GNU_SOURCE   -Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=cpp -Wno-reorder -Wno-missing-field-initializers  -fPIC  -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -fno-strict-aliasing -ftemplate-depth=900
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed  -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed

-- Configuring done
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 8843
Location: almost Mile High in the USA

PostPosted: Sat Aug 14, 2021 8:02 pm    Post subject: Reply with quote

Well in the compiler flags section it puts a superfluous -DNO_AES there but theres no -maes so this is actually the desired behavior, however, if it did not actually emit any aes instructions, then it doesn't matter. Maybe gcc couldn't figure out how to convert C to using the aes instructions *shrug*...

Well, at least it works so I guess it's a no-op...
_________________
Intel Core i7 2700K/Radeon FirePro V3900/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum