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

build static aria2 have error #1908

Open
jazz1611 opened this issue Apr 9, 2022 · 20 comments
Open

build static aria2 have error #1908

jazz1611 opened this issue Apr 9, 2022 · 20 comments

Comments

@jazz1611
Copy link

jazz1611 commented Apr 9, 2022

hello @tatsuhiro-t,

i just make new build static aria2 with latest your update. but it have error when run make. there is log. can you check it?

  CXX      SessionSerializer.lo
  CXX      Signature.lo
  CXX      SimpleRandomizer.lo
SimpleRandomizer.cc: In member function 'void aria2::SimpleRandomizer::getRandomBytes(unsigned char*, size_t)':
SimpleRandomizer.cc:110:37: error: 'getentropy' was not declared in this scope
     auto rv = getentropy(p, blocklen);
                                     ^
SimpleRandomizer.cc:125:30: error: 'getentropy' was not declared in this scope
   auto rv = getentropy(p, rem);
                              ^
make[3]: *** [SimpleRandomizer.lo] Error 1
make[3]: Leaving directory `/root/aria2/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/aria2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/aria2'
make: *** [all] Error 2
@tatsuhiro-t
Copy link
Collaborator

My initial guess is that your linux (?) is too old or some sort. Ubuntu 20.04 should work.

@jazz1611
Copy link
Author

jazz1611 commented Apr 9, 2022

My initial guess is that your linux (?) is too old or some sort. Ubuntu 20.04 should work.

this is CentOS 7.9 x64 latest version. there is my command to make build static aria2c. before you have latest update then i can make build static as normal.

yum -y install libgnutls-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config libgpg-error-dev libgcrypt-dev libssl-dev libexpat1-dev gcc gcc-c++ kernel-devel libgcrypt-devel libxml2-devel openssl-devel gettext-devel cppunit libxml2-dev libcppunit-dev autoconf automake autotools-dev autopoint libtool
git clone https://github.com/aria2/aria2
cd aria2
autoreconf -i
./configure ARIA2_STATIC=yes
make (error in here)
make install

@jazz1611
Copy link
Author

jazz1611 commented Apr 10, 2022

hello @tatsuhiro-t ,

i just make build static aria2c with Ubuntu 20.04 and it work fine. but can you give tutorial how to make build it in CentOS 7 with your latest update?

there is command for who want make build static in Ubuntu 20.04

apt-get -y install libssh2-1-dev libc-ares-dev zlib1g-dev libsqlite3-dev pkg-config libssl-dev libexpat1-dev gcc g++ make cmake libcppunit-dev autoconf automake autotools-dev autopoint libtool
git clone https://github.com/aria2/aria2
cd aria2
autoreconf -i
./configure ARIA2_STATIC=yes
make
make install

@abcfy2
Copy link

abcfy2 commented Apr 16, 2022

@jazz1611
Copy link
Author

jazz1611 commented Apr 17, 2022

hello @tatsuhiro-t ,

i found problem aria2c can't build in CentOS 7 with your latest update. the getentropy require glibc version from 2.25 or more but max version of glibc in CentOS 7 is 2.17 and no way update to latest glibc version. i have try build static the aria2c in Ubuntu and it work but can't use that aria2c (build in Ubuntu) in CentOS 7 because have error at below .So can you have solution for this case?

Source: https://man7.org/linux/man-pages/man3/getentropy.3.html#VERSIONS
The getentropy() function first appeared in glibc 2.25.

Exception: [AbstractCommand.cc:351] errorCode=1 URI=https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
  -> [SocketCore.cc:1018] errorCode=1 SSL/TLS handshake failure: unable to get local issuer certificate

[root@test ~]# ./aria2c --version
aria2 version 1.36.0
Copyright (C) 2006, 2019 Tatsuhiro Tsujikawa

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

** Configuration **
Enabled Features: Async DNS, BitTorrent, Firefox3 Cookie, GZip, HTTPS, Message Digest, Metalink, XML-RPC, SFTP
Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5, adler32
Libraries: zlib/1.2.11 libxml2/2.9.10 sqlite3/3.31.1 OpenSSL/1.1.1f c-ares/1.15.0 libssh2/1.8.0
Compiler: gcc 9.4.0
  built by  x86_64-pc-linux-gnu
  on        Apr 18 2022 02:32:10
System: Linux 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64

Report bugs to https://github.com/aria2/aria2/issues
Visit https://aria2.github.io/

@tatsuhiro-t
Copy link
Collaborator

We cannot support old OS forever. Cent OS is EOL in few years. Better to be upgraded to something new.
If you really want to compile aria2 on Cent OS, revert the relevant commit.

@abcfy2
Copy link

abcfy2 commented Apr 18, 2022

You can try my build with musl static build. It works for most Linux distro. Includes CentOS 7.

@jazz1611
Copy link
Author

You can try my build with musl static build. It works for most Linux distro. Includes CentOS 7.

hello, i need more than 16 connection per server, that reason i need make custom static build.

We cannot support old OS forever. Cent OS is EOL in few years. Better to be upgraded to something new. If you really want to compile aria2 on Cent OS, revert the relevant commit.

so, can fix ssl cert in CentOS7 when use build from Ubuntu ?

@jazz1611
Copy link
Author

@abcfy2 i just test 2 file from aria2-x86_64-linux-musl_libressl_static.zip and aria2-x86_64-linux-musl_static.zip in CentOS 7 and always get error with SSL

[root@CentOS-79-64-minimal ~]# ./aria2c "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"

04/18 16:17:35 [NOTICE] Downloading 1 item(s)

04/18 16:17:35 [ERROR] CUID#7 - Download aborted. URI=https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
Exception: [AbstractCommand.cc:351] errorCode=1 URI=https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
  -> [SocketCore.cc:1018] errorCode=1 SSL/TLS handshake failure: unable to get local issuer certificate

04/18 16:17:35 [NOTICE] Download GID#21a8a0e11b00d127 not complete:

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
21a8a0|ERR |       0B/s|https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.
[root@CentOS-79-64-minimal ~]# ./aria2c --version
aria2 version 1.36.0
Copyright (C) 2006, 2019 Tatsuhiro Tsujikawa

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

** Configuration **
Enabled Features: Async DNS, BitTorrent, Firefox3 Cookie, GZip, HTTPS, Message Digest, Metalink, XML-RPC, SFTP
Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5, adler32
Libraries: zlib/1.2.11.zlib-ng libxml2/2.9.13 sqlite3/3.38.2 OpenSSL/2.0.0 c-ares/1.18.1 libssh2/1.10.0
Compiler: gcc 11.2.1 20211120
  built by  x86_64-pc-linux-gnu
  targeting x86_64-pc-linux-musl
  on        Apr 16 2022 01:30:29
System: Linux 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64

Report bugs to https://github.com/aria2/aria2/issues
Visit https://aria2.github.io/

@abcfy2
Copy link

abcfy2 commented Apr 18, 2022

@jazz1611 You may try:

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
./aria2c ....

I'll update README later about this issue.

@jazz1611
Copy link
Author

@jazz1611 You may try:

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
./aria2c ....

I'll update README later about this issue.

hello, there is default SSL cert file
img

@abcfy2
Copy link

abcfy2 commented Apr 18, 2022

Seems you still use a very old CentOS 7 without do any yum upgrade.

If /etc/ssl/certs/ca-certificates.crt does not exists. You may try:

export SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

And this file should exist.

@jazz1611
Copy link
Author

@abcfy2
i'm using latest version of CentOS 7

[root@CentOS-79-64-minimal ~]# uname -a
Linux CentOS-79-64-minimal 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

i have try with this command and it work

./aria2c "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" --ca-certificate='/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem'

but with this url it fail.

[root@CentOS-79-64-minimal ~]# ./aria2c "https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4" --ca-certificate='/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem'

04/18 16:41:11 [NOTICE] Downloading 1 item(s)

04/18 16:41:11 [ERROR] CUID#7 - Download aborted. URI=https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4
Exception: [AbstractCommand.cc:351] errorCode=1 URI=https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4
  -> [SocketCore.cc:1018] errorCode=1 SSL/TLS handshake failure: protocol error

04/18 16:41:11 [NOTICE] Download GID#bd133a5df64626bd not complete:

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
bd133a|ERR |       0B/s|https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.

if use custom build without getentropyupdate from git in CentOS 7

[root@CentOS-79-64-minimal ~]# aria2c "https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4"

04/18 16:44:53 [NOTICE] Downloading 1 item(s)

04/18 16:44:54 [NOTICE] CUID#7 - Redirecting to https://file37.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4
[#39e8c4 0B/0B CN:1 DL:0B]
04/18 16:44:54 [NOTICE] CUID#7 - Redirecting to https://gofile.io/d/9d38327d-8899-4deb-b2b8-86d68aa50fef

04/18 16:44:55 [NOTICE] Download complete: /root/9d38327d-8899-4deb-b2b8-86d68aa50fef

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
39e8c4|OK  |   1.2MiB/s|/root/9d38327d-8899-4deb-b2b8-86d68aa50fef

Status Legend:
(OK):download completed.

@abcfy2
Copy link

abcfy2 commented Apr 18, 2022

I can't reproduce your issue. I run a fresh CentOS 7 from docker:

docker run --rm -it centos:7

Then:

# ./aria2c "https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4" --ca-certificate='/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem'

04/18 09:50:53 [NOTICE] Downloading 1 item(s)
[#446ad5 0B/0B CN:1 DL:0B]                                                                                                                                                          
04/18 09:50:55 [NOTICE] CUID#7 - Redirecting to https://file37.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4
[#446ad5 0B/0B CN:1 DL:0B]                                                                                                                                                          
04/18 09:50:56 [NOTICE] CUID#7 - Redirecting to https://gofile.io/d/9d38327d-8899-4deb-b2b8-86d68aa50fef
[#446ad5 0B/28KiB(0%) CN:1 DL:13KiB ETA:2s]                                                                                                                                         
04/18 09:50:59 [NOTICE] Download complete: /9d38327d-8899-4deb-b2b8-86d68aa50fef

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
446ad5|OK  |    49KiB/s|/9d38327d-8899-4deb-b2b8-86d68aa50fef

Status Legend:
(OK):download completed.

And set SSL_CERT_FILE also working:

# SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ./aria2c "https://store4.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4"   

04/18 09:53:04 [NOTICE] Downloading 1 item(s)
[#066184 0B/0B CN:1 DL:0B]                                                                                                                                                          
04/18 09:53:05 [NOTICE] CUID#7 - Redirecting to https://file37.gofile.io/download/844ac2c6-c71e-4334-aa7d-af0115b307ad/demo.mp4
[#066184 0B/0B CN:1 DL:0B]                                                                                                                                                          
04/18 09:53:07 [NOTICE] CUID#7 - Redirecting to https://gofile.io/d/9d38327d-8899-4deb-b2b8-86d68aa50fef
[#066184 0B/0B CN:1 DL:0B]                                                                                                                                                          
04/18 09:53:09 [NOTICE] Download complete: /9d38327d-8899-4deb-b2b8-86d68aa50fef

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
066184|OK  |    98KiB/s|/9d38327d-8899-4deb-b2b8-86d68aa50fef

Status Legend:
(OK):download completed.

@jazz1611
Copy link
Author

@abcfy2 i just try build from your script with custom flag in Ubuntu 20.04 and copy aria2c to CentOS 7, it working perfectly.

CROSS_HOST=x86_64-linux-musl ARIA2_EXT_CONF='--with-ca-bundle=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem' bash build.sh

if your script can auto detect SSL cert file /etc/ssl/certs/ca-certificates.crt not found then switch to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem will be nice

@abcfy2
Copy link

abcfy2 commented Apr 18, 2022

@abcfy2 i just try build from your script with custom flag in Ubuntu 20.04 and copy aria2c to CentOS 7, it working perfectly.

CROSS_HOST=x86_64-linux-musl ARIA2_EXT_CONF='--with-ca-bundle=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem' bash build.sh

if your script can auto detect SSL cert file /etc/ssl/certs/ca-certificates.crt not found then switch to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem will be nice

That's impossible. See issue: openssl/openssl#7481

But most distros will contains /etc/ssl/certs.pem(Ubuntu/CentOS 8/OpenSUSE/...). So I set openssl/libressl compile options --openssldir=/etc/ssl/, this will work for most distros.

But if your distro does not contains /etc/ssl/certs.pem, you have to set --ca-certificate (or ca-certificate= in ~/.aria2/aria2.conf) or set SSL_CERT_FILE environment variable.

@jazz1611
Copy link
Author

thank you guys. my case was resolved. hope you can notice there error in your page then user can easy to know it. i still use CentOS 7 because my project can't run higher OS at this time.

@jazz1611
Copy link
Author

jazz1611 commented Sep 5, 2022

@abcfy2 how can i compile this #1857 to your custom build?

@abcfy2
Copy link

abcfy2 commented Sep 5, 2022

@abcfy2 how can i compile this #1857 to your custom build?

My build will store download cache in downloads/. So you have to prepared a aria2-master.tar.gz under downloads/ directory. See: https://github.com/abcfy2/aria2-static-build/blob/main/build.sh#L385-L388

You can merge the PR locally and use git archive HEAD -o aria2-master.tar.gz to create your own aria2 source code package with the custom patches.

Then move aria2-master.tar.gz to downloads/ directory.

NOTE: aria2-master.tar.gz only work when modified time within 7 days. See: https://github.com/abcfy2/aria2-static-build/blob/main/build.sh#L364-L373

@100apps
Copy link

100apps commented Jan 23, 2023

getentropy is related to glibc version,I've tested this PR, it works for me:

#2000

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

4 participants