JayDDee / cpuminer-opt

Optimized multi algo CPU miner
Other
763 stars 541 forks source link

curl cross compilation change #394

Closed gsaviane closed 1 year ago

gsaviane commented 1 year ago

In the documentation for the "hard way", the given option for cross compiling curl are no longer working

$ ./configure --with-winssl --with-winidn --host=x86_64-w64-mingw32

--with-winssl must be replaced with --with-schannel and it does not compile with curl v8.x. It works with 7.88.1

JayDDee commented 1 year ago

This looks like 2 issues please clarify.

The "hard way" is only supported with Ubuntu-20.04 and the included versions of curl, openssl, etc. I still use that for the binaries package and it works. I have no intentions of upgrading ether the distro or any of the packages compiled from source because it's only purpose is for building the Windows binaries package for less technical users. The package only includes a limited set of supported CPU architectures therefore building the "easy way" is preferred.

Consequently I won't investigate the problems with curl-8.

Please provide the configuratiuon that fails with --with-winssl

I don't know anything about schannel but would be interested in knowing why ssl didn't work.

gsaviane commented 1 year ago

It's exactly what I did. I wanted to cross compile Windows binaries in Ubuntu 20.04. This is what I got with latest curl version (8.1.1). The CLI you suggested for cross compiling returns this error

configure: error: select TLS backend(s) or disable TLS with --without-ssl.

Select from these:

--with-amissl --with-bearssl --with-gnutls --with-mbedtls --with-nss --with-openssl (also works for BoringSSL and libressl) --with-rustls --with-schannel --with-secure-transport --with-wolfssl

After some investigation I found that --with-winssl is no longer supported. --with-schannel should be used instead (see https://everything.curl.dev/build/tls). I was able to cross compile curl 7.88.1 with the following CLI

OPEN_SSL_DIR=${SCRIPT_DIR}/../openssl-OpenSSL_1_1_1s
CPPFLAGS="-I${OPEN_SSL_DIR}/include" \
        LDFLAGS="-L${SOPEN_SSL_DIR}/lib" \
        ./configure --host=x86_64-w64-mingw32 \
        --with-schannel \
        --with-winidn

make -j4
JayDDee commented 1 year ago

I did my compiling with the original Ubuntu-20.04 (no point release). I have since updated Ubuntu packages but not upgraded and recompiled curl, openssl etc for mingw. What versions are you trying to compile? Have you tried with --with-openssl instead of switching to schannel?

gsaviane commented 1 year ago

Yes, already tried that --with-openssl could not be detected, without path specification neither with path. As I said, curl 8.1.1 version does not compile at all. curl 7.88.1 compiles with the options I provided.

Which version of curl are you compiling?

JayDDee commented 1 year ago

It would appear curl dropped winssl between v7.68 & 7.88. Did you try with v7.68. Also try with openssl-1.1.1f in case that's also a problem.

gsaviane commented 1 year ago

No I didn't check any older version of curl as it worked as I explained. Same for openssl, I'm using 1.1.1s. So for the sake of clarity, either the documentation should stick to a specific version, or move forward with supported options.

JayDDee commented 1 year ago

Are those the same versions as the Ubuntu packages? If so I will update the doc to list specific versions. Is it only curl that is restricted to older versions?

gsaviane commented 1 year ago

The versions I mentioned are not the -dev versions from the Ubuntu packages as they cannot be used for cross compile. As per your documentation:

  1. Download and build other packages for mingw that don't have a mingw64 version available in the repositories.

Download the following source code packages from their respective and respected download locations, copy them to $HOME/usr/lib/ and uncompress them.

The versions I mentioned are of sources downloaded from the links provided in the documentation:

openssl: https://github.com/openssl/openssl/releases

curl: https://github.com/curl/curl/releases

gmp: https://gmplib.org/download/gmp/

But without any version specification, one tend to download the latest available. So, that's my suggestion, either one of the two:

JayDDee commented 1 year ago

In most cases the latest version is ok but it's safest to download the same major and minor version as included in your distribution. The following uses versions from Ubuntu 20.04. Change version numbers as required.

That should have been a clue. It didn't work so revert to the default versions. This was intended to document the process used for building the binaries package. It's not intended for users, modify it at your own risk.

I'll make that clear and make default versions a requirement.

gsaviane commented 1 year ago

I think it would be easier to switch permanently to --with-schannel. Suggested since 7.65 version of curl https://github.com/curl/curl/pull/3504 I tried it with same version of Ubuntu 20.04 (7.68). It works too.

JayDDee commented 1 year ago

I think it would be easier to switch permanently to --with-schannel.

Definitely not easier, would require extensive testing on different versions of Windows. Nothing is really broken, you went off script with a tool not intended for users.

Also binaries are not guaranteed, the only reason I still provide them is because the build environment still works. I've moved it to a VM so I don't need to keep a Ubuntu-20.04 PC hanging around. It should work until Microsoft does something to break it on Windows, at which point I'll stop delivering binaries.

Furthermore cpuminer development is winding down, this may all become moot.

Until then clarifying the doc is as much as I'll do.

If I was to change the build that significantly I'd also look at upgrading the Ubuntu host OS, it might solve the problem with curl v8.

JayDDee commented 1 year ago

Build instructions have been clarified to discourage users fom using the "hard way". In addition version numbers have been added to help those who choose it anyway.