Why compile openssl with no_asm by default?

openssl asm is disabled by default in common.gypi
'openssl_no_asm%': 1, # Must be defined in OpenSSL >= 1.1.0g.
compile with asm_avx2 will increase performance by 10%~15%.
So is there any reason to disable asm?

I’ve noticed that the optimisation flags doesn’t seem to be used in g++ compilation, by looking at https://github.com/versatica/mediasoup/blob/v3/worker/compile_commands_template.json I don’t see any -O usage.

Any reason to not use them? they could bring some CPU performance improvements too. Its kinda of related to the above.

Please, specify what exactly should be done. We will move from GYP to CMake soon, so I don’t want to spend much time on this.

Okey, maybe i find the reason.
It seems the gyp config of openssl and mediasoup is reference to node.js
In previous version of nodejs, openssl_no_asm is set to 1 because of compile problem in arm64.

But in the last version, it is set to 0.

To fix it, I setted ‘openssl_no_asm%’: 0 in common.gypi.
But i got some error when compiling:

gyp: name ‘v’ is not defined while evaluating condition ‘gas_version and v(gas_version) >= v(“2.26”) or nasm_version and v(nasm_version) >= v(“2.11.8”)’ in /mediasoup-3.5/worker/deps/openssl/openssl.gyp

It’s because we are using gyp, but nodejs is using node-gyp, and v is a function defined in node-gyp.
So we should either remove those lines(i’m not sure what are they used for) from \worker\deps\openssl\openssl.gyp or switch to node-gyp.

 'gas_version and v(gas_version) >= v("2.26") or '
           'nasm_version and v(nasm_version) >= v("2.11.8")', {
           # Require AVX512IFMA supported. See
           # https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
           # Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.
          'includes': ['./openssl_asm.gypi'],
        },

Yes, there is no -O option currently, nodejs is using -O3 for release version by default.
You can add -O option in line 26 of common.gypi


Someone says -O3 is slower than -O2 in some situations, so we need to test it.
1 Like

Shall we switch to node-gyp and enable openssl_asm
Or keep using gyp and remove those uncompatible lines
Or just do nothing and wait for CMake

Hi, guys. The idea is dropping gyp and moving to CMake:

1 Like