Snapcraft.io Build Failing due to wget?


#1
Downgrading OpenSSL to 1.0.1j
--2019-04-22 23:47:05--  http://www(dot)openssl(dot)org/source/openssl-1.0.1j.tar.gz
Resolving openssl(dot)org (openssl(dot)org)... failed: Name or service not known.
wget: unable to resolve host address 'openssl'
Failed to run 'override-build': Exit code was 4.
Build failed

I am trying to build my snaps via the snapcraft io Github service, if I run my snapcraft.yaml locally, I can not replicate the issue with wget unable to resolve the host address openssl org, this only happens via the snapcraft io build service, which I really want to use, does anyone have any ideas on why wget would fail to resolve openssl? I have tried using HTTPS and HTTP.


#2

I did try to add the snapcraft proxy to the wget commands in the snapcraft.yaml, however it does seem to still fail, this URL resolves just fine on any other machine, Snapcraft io just fails to build.

Downgrading OpenSSL to 1.0.1j
--2019-04-23 18:29:45--  http://www.openssl.org/source/openssl-1.0.1j.tar.gz
Connecting to 10.10.10.1:8222... connected.
Proxy request sent, awaiting response... [23/Apr/2019:18:29:45 +0000] "GET http://www.openssl.org/source/openssl-1.0.1j.tar.gz HTTP/1.1" 301 341 "-" "Wget/1.17.1 (linux-gnu)"
301 Moved Permanently
Location: https://www.openssl.org/source/openssl-1.0.1j.tar.gz [following]
--2019-04-23 18:29:45--  https://www.openssl.org/source/openssl-1.0.1j.tar.gz
Resolving www.openssl.org (www.openssl.org)... failed: Name or service not known.
wget: unable to resolve host address ‘www.openssl.org’
Failed to run 'override-build': Exit code was 4.
Build failed

#3

Any chance you could share the snapcraft.yaml snippet responsible for this? It looks like you’re using wget in an override-pull or something, but it’s not clear why you’re doing that as opposed to simply making it its own part with its own source.


#4

I attempted switching to curl -O instead of wget, and same issue with not resolving the host, the snapcraft.yaml is available here: https://github.com/carsenk/denarius/blob/master/snapcraft.yaml

Downgrading OpenSSL to 1.0.1j
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: www.openssl.org
Failed to run 'override-build': Exit code was 6.
Build failed

#5

@kyrofa I am using override-build basically, I have to downgrade openssl (libssl-dev) on certain Ubuntu versions as the openssl version changed in 18.04+, so doing this method of downloading openssl/compiling it is ideal for maximum distro support until we actually update our actual code to be compatible and backward compatible with the latest openssl. Please let me know, I have just only two calls to wget or curl in my .yaml so hopefully we can get them working!


#6

I’m sure you know what you’re doing regarding openssl, but downloading and building code is exactly what parts are for (and they tend to work with the proxy build.snapcraft.io uses). Consider trying something like this:

parts:
  part-that-needs-openssl:
    plugin: autotools
    source: <whatever>
    after: [openssl]

  openssl:
    plugin: autotools  # no idea what openssl uses, so I'm pretending
    source: <url to openssl 1.0.1j>

#7

See so the problem with that method is that I need to sys link openssl and run the different makes as it requires make, make depend, and make install. Is there a way to have it run commands in that openssl folder? Just not sure what the location would be for the snapcraft.yaml We also don’t use autotools or anything like that currently, mainly build-essential, external libs including openssl.

Also further down in the snapcraft.yaml I do have it pulling another .zip file from a repo to unzip into a particular folder, I would assume since wget and curl don’t work for the openssl.tar.gz it wouldnt work for the .zip, so how would I fix that? I dont understand why it is not finding the hostname, when the files are available and the hostnames are resolving.

Also for the openssl part, it does seem to work with that proper formatting:

  openssl:
    plugin: nil
    source: https://www.openssl.org/source/openssl-1.0.1j.tar.gz
    build-packages:
      - g++
      - build-essential
    override-build: |
      echo "Downgrading OpenSSL to 1.0.1j"
      sudo ./config
      sudo make
      sudo make depend
      sudo make install
      sudo ln -sf /usr/local/ssl/bin/openssl `which openssl`

At least locally, but I would assume snapcraft.io will work now, so I am not sure what to do for the .zip download and unzipping of it as it is not a source later on in the snapcraft.yaml


#8

If you do it in a part that another part depends on like @kyrofa described above, it will put the binaries the openssl part produces into the right spots inside the build env so the following parts will find it and link against it, you do not need to push it into the host under /usr/local or whatnot, snapcraft is intelligent enough to arrange that for you without the intrusive host mangling.

parts:
  openssl:
    plugin: make
    source: https://www.openssl.org/source/openssl-1.0.1j.tar.gz
    build-packages:
      - g++
      - build-essential
    override-build: |
      ./config
      snapcraftctl build
  denarius:
    after: [desktop-qt5, openssl]
    ...