Closed bghjmn32 closed 1 year ago
Have you tried this: https://stackoverflow.com/a/54403068/10162645 ?
Have you tried this: https://stackoverflow.com/a/54403068/10162645 ?
thank you for your help.
Yes I have tried. But it doesn't work for me.
I also tried a few website by curl. It seems only curl https://www.google.com/ may works.
attempt like curl yahoo will received
curl: (7) Failed to connect to de.yahoo.com port 443 after 20 ms: Bad access
>curl https://github.com/
curl: (7) Failed to connect to github.com port 443 after 27 ms: Bad access
the weird part is I can do git clone (like in the first step).
update:
I managed to update ca-certificate again. It works for all links except github.
curl -k https://github.com
can work if I use -k to skip certificates check.
So I think it might be proxy and firewall probelm.
When I look into bootstrap-vcpkg.sh.
I found there is indeed a github link in it.
https://github.com/microsoft/vcpkg-tool/releases/download/$vcpkgToolReleaseTag/$vcpkgToolName
But I don't know how to modify the file bootstrap-vcpkg.sh to let the downloading skip certificate check.
Sorry for the newbie question.
#!/bin/sh
# Find .vcpkg-root.
vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P)
while [ "$vcpkgRootDir" != "/" ] && ! [ -e "$vcpkgRootDir/.vcpkg-root" ]; do
vcpkgRootDir="$(dirname "$vcpkgRootDir")"
done
# Parse arguments.
vcpkgDisableMetrics="OFF"
vcpkgUseSystem=false
vcpkgUseMuslC="OFF"
for var in "$@"
do
if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then
vcpkgDisableMetrics="ON"
elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then
echo "Warning: -useSystemBinaries no longer has any effect; ignored. Note that the VCPKG_USE_SYSTEM_BINARIES environment variable behavior is not changed."
elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then
echo "Warning: -allowAppleClang no longer has any effect; ignored."
elif [ "$var" = "-buildTests" ]; then
echo "Warning: -buildTests no longer has any effect; ignored."
elif [ "$var" = "-musl" ]; then
vcpkgUseMuslC="ON"
elif [ "$var" = "-help" -o "$var" = "--help" ]; then
echo "Usage: ./bootstrap-vcpkg.sh [options]"
echo
echo "Options:"
echo " -help Display usage help"
echo " -disableMetrics Mark this vcpkg root to disable metrics."
echo " -musl Use the musl binary rather than the glibc binary on Linux."
exit 1
else
echo "Unknown argument $var. Use '-help' for help."
exit 1
fi
done
# Enable using this entry point on windows from git bash by redirecting to the .bat file.
unixName=$(uname -s | sed 's/MINGW.*_NT.*/MINGW_NT/')
if [ "$unixName" = "MINGW_NT" ]; then
if [ "$vcpkgDisableMetrics" = "ON" ]; then
args="-disableMetrics"
else
args=""
fi
vcpkgRootDir=$(cygpath -aw "$vcpkgRootDir")
cmd "/C $vcpkgRootDir\\bootstrap-vcpkg.bat $args" || exit 1
exit 0
fi
# Determine the downloads directory.
if [ -z ${VCPKG_DOWNLOADS+x} ]; then
downloadsDir="$vcpkgRootDir/downloads"
else
downloadsDir="$VCPKG_DOWNLOADS"
if [ ! -d "$VCPKG_DOWNLOADS" ]; then
echo "VCPKG_DOWNLOADS was set to '$VCPKG_DOWNLOADS', but that was not a directory."
exit 1
fi
fi
# Check for minimal prerequisites.
vcpkgCheckRepoTool()
{
__tool=$1
if ! command -v "$__tool" >/dev/null 2>&1 ; then
echo "Could not find $__tool. Please install it (and other dependencies) with:"
echo "On Debian and Ubuntu derivatives:"
echo " sudo apt-get install curl zip unzip tar"
echo "On recent Red Hat and Fedora derivatives:"
echo " sudo dnf install curl zip unzip tar"
echo "On older Red Hat and Fedora derivatives:"
echo " sudo yum install curl zip unzip tar"
echo "On SUSE Linux and derivatives:"
echo " sudo zypper install curl zip unzip tar"
echo "On Arch Linux and derivatives:"
echo " sudo pacman -S curl zip unzip tar cmake ninja"
echo "On Alpine:"
echo " apk add build-base cmake ninja zip unzip curl git"
echo " (and export VCPKG_FORCE_SYSTEM_BINARIES=1)"
exit 1
fi
}
vcpkgCheckRepoTool curl
vcpkgCheckRepoTool zip
vcpkgCheckRepoTool unzip
vcpkgCheckRepoTool tar
UNAME="$(uname)"
ARCH="$(uname -m)"
if [ -e /etc/alpine-release ]; then
vcpkgUseSystem="ON"
if [ "$ARCH" = "x86_64" ]; then
vcpkgUseMuslC="ON"
fi
fi
if [ "$UNAME" = "OpenBSD" ]; then
vcpkgUseSystem="ON"
if [ -z "$CXX" ]; then
CXX=/usr/bin/clang++
fi
if [ -z "$CC" ]; then
CC=/usr/bin/clang
fi
fi
if [ "$vcpkgUseSystem" = "ON" ]; then
vcpkgCheckRepoTool cmake
vcpkgCheckRepoTool ninja
vcpkgCheckRepoTool git
vcpkgCheckRepoTool gcc
fi
# Determine what we are going to do to bootstrap:
# MacOS -> Download vcpkg-macos
# Linux
# useMuslC -> download vcpkg-muslc
# amd64 -> download vcpkg-glibc
# Otherwise
# Download and build from source
# Choose the vcpkg binary to download
vcpkgDownloadTool="ON"
vcpkgToolReleaseTag="2023-04-07"
if [ "$UNAME" = "Darwin" ]; then
echo "Downloading vcpkg-macos..."
vcpkgToolReleaseSha="2a2805aa251a9523311c813e9e68896f18805fed4ace301c603f4afac3940b27d4ef1d3b4572c8f93ce4d13ac613720275b9e21e39cc5d19115d2fc849bfe2bb"
vcpkgToolName="vcpkg-macos"
elif [ "$vcpkgUseMuslC" = "ON" ]; then
echo "Downloading vcpkg-muslc..."
vcpkgToolReleaseSha="d8dc48e6dc866f4ebe3919c0bf1377769d6c6f1ad2dab7fc09da9b26f7dac3ab3b06affb585ece7ba72e2fdeacdc77b8df31ad08cff49e4c060b7647fc1cc22a"
vcpkgToolName="vcpkg-muslc"
elif [ "$ARCH" = "x86_64" ]; then
echo "Downloading vcpkg-glibc..."
vcpkgToolReleaseSha="f26aaf5f503b9fd0a8b206230df19af966390d7087a9f3342f24c2d5e73f1f1bd81cba2695a89c87015ec822bd41bf836c2a9ef9f0e11acc61d6d9593aa8fae9"
vcpkgToolName="vcpkg-glibc"
else
echo "Unable to determine a binary release of vcpkg; attempting to build from source."
vcpkgDownloadTool="OFF"
vcpkgToolReleaseSha="89dc32154e22f6a51fa18a8ea22c16263533546469f73cdb4ee168ab7c68ebc2b2a93177284dc03ecf2d2ca438f9fd583def48844788942e98ea45027e8ec2fa"
fi
# Do the download or build.
vcpkgCheckEqualFileHash()
{
url=$1; filePath=$2; expectedHash=$3
if command -v "sha512sum" >/dev/null 2>&1 ; then
actualHash=$(sha512sum "$filePath")
else
# sha512sum is not available by default on osx
# shasum is not available by default on Fedora
actualHash=$(shasum -a 512 "$filePath")
fi
actualHash="${actualHash%% *}" # shasum returns [hash filename], so get the first word
if ! [ "$expectedHash" = "$actualHash" ]; then
echo ""
echo "File does not have expected hash:"
echo " url: [ $url ]"
echo " File path: [ $downloadPath ]"
echo " Expected hash: [ $sha512 ]"
echo " Actual hash: [ $actualHash ]"
exit 1
fi
}
vcpkgDownloadFile()
{
url=$1; downloadPath=$2 sha512=$3
rm -rf "$downloadPath.part"
curl -L $url --tlsv1.2 --create-dirs --retry 3 --output "$downloadPath.part" --silent --show-error --fail || exit 1
vcpkgCheckEqualFileHash $url "$downloadPath.part" $sha512
chmod +x "$downloadPath.part"
mv "$downloadPath.part" "$downloadPath"
}
vcpkgExtractTar()
{
archive=$1; toPath=$2
rm -rf "$toPath" "$toPath.partial"
mkdir -p "$toPath.partial"
$(cd "$toPath.partial" && tar xzf "$archive")
mv "$toPath.partial" "$toPath"
}
if [ "$vcpkgDownloadTool" = "ON" ]; then
vcpkgDownloadFile "https://github.com/microsoft/vcpkg-tool/releases/download/$vcpkgToolReleaseTag/$vcpkgToolName" "$vcpkgRootDir/vcpkg" $vcpkgToolReleaseSha
else
if [ "x$CXX" = "x" ]; then
if which g++-12 >/dev/null 2>&1; then
CXX=g++-12
elif which g++-11 >/dev/null 2>&1; then
CXX=g++-11
elif which g++-10 >/dev/null 2>&1; then
CXX=g++-10
elif which g++-9 >/dev/null 2>&1; then
CXX=g++-9
elif which g++-8 >/dev/null 2>&1; then
CXX=g++-8
elif which g++-7 >/dev/null 2>&1; then
CXX=g++-7
elif which g++-6 >/dev/null 2>&1; then
CXX=g++-6
elif which g++ >/dev/null 2>&1; then
CXX=g++
fi
# If we can't find g++, allow CMake to do the look-up
fi
vcpkgToolReleaseTarball="$vcpkgToolReleaseTag.tar.gz"
vcpkgToolUrl="https://github.com/microsoft/vcpkg-tool/archive/$vcpkgToolReleaseTarball"
baseBuildDir="$vcpkgRootDir/buildtrees/_vcpkg"
buildDir="$baseBuildDir/build"
tarballPath="$downloadsDir/$vcpkgToolReleaseTarball"
srcBaseDir="$baseBuildDir/src"
srcDir="$srcBaseDir/vcpkg-tool-$vcpkgToolReleaseTag"
if [ -e "$tarballPath" ]; then
vcpkgCheckEqualFileHash "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
else
echo "Downloading vcpkg tool sources"
vcpkgDownloadFile "$vcpkgToolUrl" "$tarballPath" "$vcpkgToolReleaseSha"
fi
echo "Building vcpkg-tool..."
rm -rf "$baseBuildDir"
mkdir -p "$buildDir"
vcpkgExtractTar "$tarballPath" "$srcBaseDir"
cmakeConfigOptions="-DCMAKE_BUILD_TYPE=Release -G 'Ninja' -DVCPKG_DEVELOPMENT_WARNINGS=OFF"
if [ "${VCPKG_MAX_CONCURRENCY}" != "" ] ; then
cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=$VCPKG_MAX_CONCURRENCY;link=$VCPKG_MAX_CONCURRENCY' "
fi
(cd "$buildDir" && CXX="$CXX" eval cmake "$srcDir" $cmakeConfigOptions) || exit 1
(cd "$buildDir" && cmake --build .) || exit 1
rm -rf "$vcpkgRootDir/vcpkg"
cp "$buildDir/vcpkg" "$vcpkgRootDir/"
fi
# Apply the disable-metrics marker file.
if [ "$vcpkgDisableMetrics" = "ON" ]; then
touch "$vcpkgRootDir/vcpkg.disable-metrics"
elif ! [ -f "$vcpkgRootDir/vcpkg.disable-metrics" ]; then
# Note that we intentionally leave any existing vcpkg.disable-metrics; once a user has
# opted out they should stay opted out.
cat <<EOF
Telemetry
---------
vcpkg collects usage data in order to help us improve your experience.
The data collected by Microsoft is anonymous.
You can opt-out of telemetry by re-running the bootstrap-vcpkg script with -disableMetrics,
passing --disable-metrics to vcpkg on the command line,
or by setting the VCPKG_DISABLE_METRICS environment variable.
Read more about vcpkg telemetry at docs/about/privacy.md
EOF
fi
Hi I managed to solve the certificates issue today.
Now I am in the last step on installing vcpkg.
When I run
(base) :~$ ./vcpkg/bootstrap-vcpkg.sh
Downloading vcpkg-glibc...
(base) :~$ vcpkg
vcpkg: command not found
if I do
cd vcpkg;
bash: ./vcpkg/bootstrap-vcpkg.sh: Not a directory
seems there is no warning but installation failed.
@Cheney-W could you please open a new issue? Sorry for the bothering but I think my issue is no longer same as yesterday.
@bghjmn32 There is no installation here.
./vcpkg/bootstrap-vcpkg.sh
runs the bootstrap-vcpkg.sh script in the vcpkg directory. That script will simply put the vcpkg tool into that directory.
vcpkg
searchs for a program called vcpkg via environment variable PATH
. Normally this wont include the vcpkg dir, so it will fail.
cd vcpkg
makes the dir with the vcpkg repo your current working dir. Now you can run vcpkg with a shot path relative to the current dir:
./vcpkg install zlib
@dg0yt
Thanks very much for your knid help!
I just cd vcpkg and tried your command ./vcpkg install zlib.
My Ubuntu:~/vcpkg$ ./vcpkg install zlib
Computing installation plan...
A suitable version of cmake was not found (required v3.25.1) Downloading portable cmake 3.25.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.tar.gz->/home/My Ubuntu/vcpkg/downloads/cmake-3.25.1-linux-x86_64.tar.gz
Extracting cmake...
The following packages will be built and installed:
* vcpkg-cmake[core]:x64-linux -> 2022-12-22
zlib[core]:x64-linux -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-linux...
Restored 0 package(s) from /home/My ubuntu/.cache/vcpkg/archives in 7.93 us. Use --debug to see more details.
Installing 1/2 vcpkg-cmake:x64-linux...
Building vcpkg-cmake[core]:x64-linux...
-- Installing: /home//vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: /homey/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: /home/i/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: /home/i/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: /home/i/vcpkg/packages/vcpkg-cmake_x64-linux/share/vcpkg-cmake/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle vcpkg-cmake:x64-linux: 16.5 ms
Installing 2/2 zlib:x64-linux...
Building zlib[core]:x64-linux...
-- Downloading https://github.com/madler/zlib/archive/v1.2.13.tar.gz -> madler-zlib-v1.2.13.tar.gz...
-- Extracting source /home/hongyi/vcpkg/downloads/madler-zlib-v1.2.13.tar.gz
-- Applying patch 0001-Prevent-invalid-inclusions-when-HAVE_-is-set-to-0.patch
-- Applying patch 0002-skip-building-examples.patch
-- Applying patch 0003-build-static-or-shared-not-both.patch
-- Applying patch 0004-android-and-mingw-fixes.patch
-- Using source at /home/hongyi/vcpkg/buildtrees/zlib/src/v1.2.13-f30d2a168d.clean
-- Configuring x64-linux
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Installing: /home//vcpkg/packages/zlib_x64-linux/share/zlib/vcpkg-cmake-wrapper.cmake
-- Fixing pkgconfig file: /home//vcpkg/packages/zlib_x64-linux/lib/pkgconfig/zlib.pc
-- Fixing pkgconfig file: /home//vcpkg/packages/zlib_x64-linux/debug/lib/pkgconfig/zlib.pc
-- Installing: /home/hongyi/vcpkg/packages/zlib_x64-linux/share/zlib/copyright
-- Performing post-build validation
Stored binaries in 1 destinations.
Elapsed time to handle zlib:x64-linux: 1.7 s
Total install time: 2.8 s
The package zlib is compatible with built-in CMake targets:
find_package(ZLIB REQUIRED)
target_link_libraries(main PRIVATE ZLIB::ZLIB)
Does this means vcpkg already works in my ubuntu?? So everytime I need to cd vcpkg and use ./vcpkg install xxx right?
Yes, vcpkg is already working on your Ubuntu.
No, you can execute the installation command in a different folder without vcpkg by using the full path to vcpkg.exe. For example, if my vcpkg is installed in /home/vxincwa/cheney/vcpkg
and I create a new empty folder called test
, I can use the following command to execute the installation command in the test
folder:
vxincwa@vxincwa-linux:~/test$ "/home/vxincwa/cheney/vcpkg" install zlib
However, please note that the installed ports will still be stored in the vcpkg folder, and test
will remain an empty folder unless you use additional parameters to change the default path to a specific location.
https://learn.microsoft.com/en-us/vcpkg/commands/common-options
@Cheney-W
Thank you for answering my newbie question!
I hope all your questions have been resolved. If so, please close this issue. Thank you!
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
Operating system
ubuntu 20.4
Compiler
No response
Steps to reproduce the behavior
Failure logs
Downloading vcpkg-glibc... curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
Additional context
I tried to look it in Stack Overflow and the website suggested in terminal, could not solve it.