Set install dirs explicitly for libcbor libraries and headers
Change: Set -DCMAKE_INSTALL_LIBDIR=lib and -DCMAKE_INSTALL_INCLUDEDIR=include to ensure libraries and headers are installed in standard locations on all platforms. Without this patch, cross-building libfido2 (and other dependents) fails because libcbor libraries and pkg-config files are not found in ${prefix}/lib; the fix ensures they’re installed in the correct location for all platforms.
I am not sure I follow: if this currently installs things into ${libdir} and ${includedir} then other packages should find them just fine as long as they also search in those dirs ? These are, after all, the "standard locations" used by packages in Yggdrasil.
Perhaps you could explain exactly is the problem without this change?
@andreeco ping
This PR is related to #12261. Without the changes I don't get libfido2 to build.
https://github.com/andreeco/Yggdrasil/blob/b20781772a3b5e8f464b4f450b714646f6808eb4/L/libfido2/build_tarballs.jl
This is the error message while building:
[13:41:29] /opt/i686-w64-mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.5/../../../../i686-w64-mingw32/bin/ld: cannot find -lcbor
[13:41:29] collect2: error: ld returned 1 exit status
Here you find the output of a find command in the sandbox, so you can see the directory issue for yourself.
sandbox:${WORKSPACE}/srcdir/libfido2-1.16.0 # find / -name 'libcbor*' 2>/dev/null
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/share/licenses/libcbor
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/libcbor.dll.a
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/libcbor.dll
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/cmake/libcbor
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/cmake/libcbor/libcborConfig.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/cmake/libcbor/libcborTargets.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/cmake/libcbor/libcborConfigVersion.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/cmake/libcbor/libcborTargets-release.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/artifacts/4f32ea78911969818939701866bf086ca9a6eba4/bin/pkgconfig/libcbor.pc
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/share/licenses/libcbor
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/libcbor.dll.a
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/libcbor.dll
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/cmake/libcbor
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/cmake/libcbor/libcborConfig.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/cmake/libcbor/libcborTargets.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/cmake/libcbor/libcborConfigVersion.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/cmake/libcbor/libcborTargets-release.cmake
/workspace/i686-w64-mingw32-libgfortran3-cxx03/destdir/bin/pkgconfig/libcbor.pc
and if I use the new build script I can build it:
[ Info: Committing and pushing libfido2_jll.jl wrapper code version 1.16.0+0...
[ Info: Generating jll package for aarch64-apple-darwin in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for aarch64-linux-gnu in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for aarch64-linux-musl in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for aarch64-unknown-freebsd in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for armv6l-linux-gnueabihf in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for armv6l-linux-musleabihf in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for armv7l-linux-gnueabihf in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for armv7l-linux-musleabihf in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for i686-linux-gnu in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for i686-linux-musl in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for i686-w64-mingw32 in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for powerpc64le-linux-gnu in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for riscv64-linux-gnu in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for x86_64-apple-darwin in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for x86_64-linux-gnu in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for x86_64-linux-musl in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for x86_64-unknown-freebsd in /home/andre/.julia/dev/libfido2_jll
[ Info: Generating jll package for x86_64-w64-mingw32 in /home/andre/.julia/dev/libfido2_jll
Thanks for your review!
Here you find the output of a find command in the sandbox, so you can see the directory issue for yourself.
I am not sure I see it. The .dll's are installed into the bin dir, which AFAIK is intentionally, because the windows dynamic linker requires DLLs to be in the same directory as the executable loading it.
So in fact that means that if you ensures libraries "are installed in standard locations on all platforms", the result may very well be unusable?
It does indeed look weird that ${bindir} then has pkgconfig and cmake subdirectories -- but then again, if everyone does that, and if then also all the build systems look there (i.e. relative libdir) all should be fine. But I'd not be surprised if some build system hardcode pkgconfigdir to ${prefix}/lib/pkgconfig... Then one may have to move or even copy the .pc files to that location.
In the LibVPX recipe I see this:
# pkgconfig file on Windows is installed to ${libdir}/pkgconfig,
# we have to move it to ${prefix}/lib/pkgconfig/
if [[ "${target}" == *-mingw* ]] && [[ -d "${libdir}/pkgconfig" ]] ; then
mkdir -p "${prefix}/lib"
mv "${libdir}/pkgconfig" "${prefix}/lib/pkgconfig"
fi
Perhaps @giordano will correct me on the above and/or has additional information to share?