conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.11k stars 964 forks source link

"conan install" says a package needs to be built, but "conan search" shows a matching binary #3092

Closed DavidZemon closed 6 years ago

DavidZemon commented 6 years ago

To help us debug your issue please explain:

Conan v1.4.4 I'm afraid I don't know if you'll be able to reproduce this since I'm using a closed-source package with a locked-down Conan server.

What I'm running into is a problem where my linux package is always being rebuilt from source on my local machine, despite the remote server showing a matching binary with appropriate options.

captain@balrog:~$ conan install OpenSSL/1.0.2n@conan/stable -s build_type=Debug --build OpenSSL
OpenSSL/1.0.2n@conan/stable: Installing package
Requirements
    OpenSSL/1.0.2n@conan/stable from local cache
    zlib/1.2.11@conan/stable from 'conan-center'
Packages
    OpenSSL/1.0.2n@conan/stable:7844130be93cd4c54d42e8d4922b936e6832525f
    zlib/1.2.11@conan/stable:485addee8a0f673df1a98da864bcbad8924300bc

Cross-build from 'Linux:x86_64' to 'Linux:armv7hf'
OpenSSL/1.0.2n@conan/stable: WARN: Package is corrupted, removing folder: /home/captain/.conan/data/OpenSSL/1.0.2n/conan/stable/package/7844130be93cd4c54d42e8d4922b936e6832525f
zlib/1.2.11@conan/stable: Already installed!
OpenSSL/1.0.2n@conan/stable: WARN: Forced build from source
OpenSSL/1.0.2n@conan/stable: Installing build requirements of: OpenSSL/1.0.2n@conan/stable
OpenSSL/1.0.2n@conan/stable: Build requires: [linux/4.9.59@wsbu/stable]
OpenSSL/1.0.2n@conan/stable: Requirements
OpenSSL/1.0.2n@conan/stable:     linux/4.9.59@wsbu/stable from local cache
OpenSSL/1.0.2n@conan/stable: Packages
OpenSSL/1.0.2n@conan/stable:     linux/4.9.59@wsbu/stable:5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8
OpenSSL/1.0.2n@conan/stable: 
linux/4.9.59@wsbu/stable: WARN: Can't find a 'linux/4.9.59@wsbu/stable' package for the specified options and settings:
- Settings: arch=armv7hf, build_type=Debug, compiler=gcc, compiler.version=4.9, platform=sitara
- Options: install_source=False
- Package ID: 5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8

ERROR: Missing prebuilt package for 'linux/4.9.59@wsbu/stable'
Try to build it from sources with "--build linux"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"

captain@balrog:~$ conan install OpenSSL/1.0.2n@conan/stable -s build_type=Debug --build OpenSSL^C
captain@balrog:~$ conan search -r ci --raw linux/4.9.59@wsbu/stable
Existing packages for recipe linux/4.9.59@wsbu/stable:

    Package_ID: 531dd80389397dad66762fc7a5794390f94be73c
        [options]
            install_source: False
        [settings]
            arch: x86_64
            build_type: Release
            compiler: gcc
            compiler.version: 7
            platform: x86_64
        Outdated from recipe: False

    Package_ID: 5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8
        [options]
            install_source: False
        [settings]
            arch: armv7hf
            build_type: Debug
            compiler: gcc
            compiler.version: 4.9
            platform: sitara
        Outdated from recipe: False

    Package_ID: 6bf0ea4e0870901858169ded5c493e679e63b143
        [options]
            install_source: True
        [settings]
            arch: armv7hf
            build_type: Debug
            compiler: gcc
            compiler.version: 4.9
            platform: sitara
        Outdated from recipe: False

    Package_ID: 711de81d3de271a59a8ab35631ab56999d4469ff
        [options]
            install_source: False
        [settings]
            arch: x86_64
            build_type: Debug
            compiler: gcc
            compiler.version: 7
            platform: x86_64
        Outdated from recipe: False

    Package_ID: 89d8238bbe04a388d5d0a2415aab0934eb33f9a3
        [options]
            install_source: True
        [settings]
            arch: x86_64
            build_type: Release
            compiler: gcc
            compiler.version: 7
            platform: x86_64
        Outdated from recipe: False

    Package_ID: b4fa5683e5676f79c5287ea1406319a98d4c4c0b
        [options]
            install_source: False
        [settings]
            arch: x86_64
            build_type: Release
            compiler: gcc
            compiler.version: 5
            platform: x86_64
        Outdated from recipe: False

    Package_ID: c0aeb4ab40733a28d360acabf2e0cb02120637a2
        [options]
            install_source: True
        [settings]
            arch: x86_64
            build_type: Debug
            compiler: gcc
            compiler.version: 7
            platform: x86_64
        Outdated from recipe: False

    Package_ID: e5019d4af3b3b792626478dfc4da5d0d972fe24c
        [options]
            install_source: False
        [settings]
            arch: armv7hf
            build_type: Release
            compiler: gcc
            compiler.version: 4.9
            platform: sitara
        Outdated from recipe: False

captain@balrog:~$ 

So the important parts that I see in the above snippet are Conan saying it's missing a package in the local cache with a specific package ID

linux/4.9.59@wsbu/stable: WARN: Can't find a 'linux/4.9.59@wsbu/stable' package for the specified options and settings:
- Settings: arch=armv7hf, build_type=Debug, compiler=gcc, compiler.version=4.9, platform=sitara
- Options: install_source=False
- Package ID: 5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8

and then the search function saying "hey, i have these package IDs"... and one of them matches (second one down).

Any ideas why it's trying to build this package from source?

memsharded commented 6 years ago

Maybe the bug that is going to be fixed in release 1.4.5 could be related, as it is package_id related. A possible way to check if it is this bug what is bothering you, is to try with conan 1.3, which seems to work well. The package_id() of the linux package might be relevant.

Thanks for the detailed report! Please try running with conan 1.3 and tell me, I will tell when conan 1.4.5 is out.

DavidZemon commented 6 years ago

Changing my Conan client (not the server) to 1.3.3 didn't help:

captain@balrog:~$ conan install 'OpenSSL/1.0.2n@conan/stable' -s build_type=Debug --build OpenSSL
OpenSSL/1.0.2n@conan/stable: Installing package
Requirements
    OpenSSL/1.0.2n@conan/stable from local cache
    zlib/1.2.11@conan/stable from local cache
Packages
    OpenSSL/1.0.2n@conan/stable:7844130be93cd4c54d42e8d4922b936e6832525f
    zlib/1.2.11@conan/stable:485addee8a0f673df1a98da864bcbad8924300bc

Cross-build from 'Linux:x86_64' to 'Linux:armv7hf'
OpenSSL/1.0.2n@conan/stable: WARN: Package is corrupted, removing folder: /home/captain/.conan/data/OpenSSL/1.0.2n/conan/stable/package/7844130be93cd4c54d42e8d4922b936e6832525f
zlib/1.2.11@conan/stable: Already installed!
OpenSSL/1.0.2n@conan/stable: WARN: Forced build from source
OpenSSL/1.0.2n@conan/stable: Installing build requirements of: OpenSSL/1.0.2n@conan/stable
OpenSSL/1.0.2n@conan/stable: Build requires: [linux/4.9.59@wsbu/stable]
OpenSSL/1.0.2n@conan/stable: Requirements
OpenSSL/1.0.2n@conan/stable:     linux/4.9.59@wsbu/stable from local cache
OpenSSL/1.0.2n@conan/stable: Packages
OpenSSL/1.0.2n@conan/stable:     linux/4.9.59@wsbu/stable:5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8
OpenSSL/1.0.2n@conan/stable: 
linux/4.9.59@wsbu/stable: WARN: Package is corrupted, removing folder: /home/captain/.conan/data/linux/4.9.59/wsbu/stable/package/5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8
linux/4.9.59@wsbu/stable: WARN: Can't find a 'linux/4.9.59@wsbu/stable' package for the specified options and settings:
- Settings: arch=armv7hf, build_type=Debug, compiler=gcc, compiler.version=4.9, platform=sitara
- Options: install_source=False
- Package ID: 5dc7c772e508a33d1fa1c2ffcd8a6aa2a66697b8

ERROR: Missing prebuilt package for 'linux/4.9.59@wsbu/stable'
Try to build it from sources with "--build linux"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"

captain@balrog:~$ conan --version
Conan version 1.3.3
captain@balrog:~$ 
memsharded commented 6 years ago

If you could please send me details of your package_id() method of the linux package it might help. You can also email us privately to info@conan.io with the profile you are using, and the linux recipe, so we could have a look. Thanks!

DavidZemon commented 6 years ago

The recipe is opensource, we just clone the kernel from our closed-source repo: https://github.com/wsbu/conan-packages/blob/master/linux/conanfile.py

memsharded commented 6 years ago

It is weird that it is showing that your local packages are "corrupted", I cannot understand why. I would suggest trying the following things:

Today it is going to be impossible, but if you want, we could connect from next Monday on slack and do a "pair-debugging" remote session. Thanks for all the feedback!

DavidZemon commented 6 years ago

I do my cross-compiles inside a Docker container, and I think the problem boiled down to user error. I was previously using this script to start the container:

#!/bin/bash

uid="$(id -u)"
gid="$(id -g)"
dir="$(pwd)"

set -e

mkdir --parents ~/.conan/data
touch ~/.conan/.conan.db

set -x
docker run -it --rm \
    --net=host \
    -w "${dir}" \
    -e uid="${uid}" \
    -e gid="${gid}" \
    -v "$HOME/.ssh/id_rsa:/home/captain/.ssh/id_rsa" \
    -v "$HOME/.ssh/known_hosts:/home/captain/.ssh/known_hosts" \
    -v "${dir}:${dir}" \
    -v "$HOME/.conan/data:/home/captain/.conan/data" \
    -v "$HOME/.conan/.conan.db:/home/captain/.conan/.conan.db" \
    wsbu/toolchain-linaro "$@"

And the key part I was missing -v "$HOME/.conan/registry.txt:/home/captain/.conan/registry.txt" \. Without that, I'd get mismatches between the registry and the cache. Once I mounted the registry, no more issues. I'll close this for now and reopen if I encounter the problem again with the new change in place.

memsharded commented 6 years ago

Oh yes, that could explain it. But then you ran the conan 1.3.3 without the docker, so that would be the reason it worked? Thanks for following up and reporting.

DavidZemon commented 6 years ago

Nope, running 1.3.3 was still in Docker. When I realized I had a sync problem with the registry, I ran conan remove on linux from my host and then added the registry option to my docker script, figuring it would be best to start from scratch with that one.