-
Notifications
You must be signed in to change notification settings - Fork 698
Install libcpp from release package other than apt-get #11832
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
40f581b
Install libcpp from release package other than apt-get
cccclai e2350e2
Update on "Install libcpp from release package other than apt-get"
cccclai db5eeda
Update on "Install libcpp from release package other than apt-get"
cccclai 4eefd95
Update on "Install libcpp from release package other than apt-get"
cccclai 0b691e4
Update on "Install libcpp from release package other than apt-get"
cccclai 1e30b88
Update on "Install libcpp from release package other than apt-get"
cccclai aef98ee
Update on "Install libcpp from release package other than apt-get"
cccclai e88d5f1
Update on "Install libcpp from release package other than apt-get"
cccclai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| set -ex | ||
|
|
||
| # Get the absolute path of this script | ||
| SCRIPT_DIR="$( cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )" | ||
|
|
||
| # Source QNN configuration from the same directory | ||
| source "${SCRIPT_DIR}/qnn_config.sh" | ||
|
|
||
| # Function to install Android NDK (only if not already set) | ||
| setup_android_ndk() { | ||
| # Check if ANDROID_NDK_ROOT is already set and valid | ||
| if [ -n "${ANDROID_NDK_ROOT}" ] && [ -d "${ANDROID_NDK_ROOT}" ]; then | ||
| echo "Android NDK already set to ${ANDROID_NDK_ROOT} - skipping installation" | ||
| return | ||
| fi | ||
|
|
||
| NDK_VERSION="r26c" | ||
| NDK_INSTALL_DIR="/tmp/android-ndk" | ||
|
|
||
| if [ -d "${NDK_INSTALL_DIR}/ndk" ]; then | ||
| echo "Android NDK already installed at ${NDK_INSTALL_DIR}/ndk" | ||
| export ANDROID_NDK_ROOT="${NDK_INSTALL_DIR}/ndk" | ||
| return | ||
| fi | ||
|
|
||
| echo "Installing Android NDK ${NDK_VERSION}" | ||
| mkdir -p "${NDK_INSTALL_DIR}" | ||
| NDK_ZIP="android-ndk-${NDK_VERSION}-linux.zip" | ||
|
|
||
| curl -Lo "/tmp/${NDK_ZIP}" "https://dl.google.com/android/repository/${NDK_ZIP}" | ||
| unzip -q "/tmp/${NDK_ZIP}" -d "${NDK_INSTALL_DIR}" | ||
| mv "${NDK_INSTALL_DIR}/android-ndk-${NDK_VERSION}" "${NDK_INSTALL_DIR}/ndk" | ||
|
|
||
| export ANDROID_NDK_ROOT="${NDK_INSTALL_DIR}/ndk" | ||
| echo "Android NDK installed to ${ANDROID_NDK_ROOT}" | ||
| } | ||
|
|
||
| verify_pkg_installed() { | ||
| dpkg-query -W --showformat='${Status}\n' "$1" | grep -q "install ok installed" | ||
| } | ||
|
|
||
| install_qnn() { | ||
| # Check if QNN_SDK_ROOT is already set and valid | ||
| if [ -n "${QNN_SDK_ROOT}" ] && [ -d "${QNN_SDK_ROOT}" ]; then | ||
| echo "QNN SDK already set to ${QNN_SDK_ROOT} - skipping installation" | ||
| return | ||
| fi | ||
|
|
||
| echo "Start installing qnn v${QNN_VERSION}" | ||
| QNN_INSTALLATION_DIR="/tmp/qnn" | ||
|
|
||
| # Clean up any previous installation | ||
| if [ -d "${QNN_INSTALLATION_DIR}" ]; then | ||
| echo "Removing previous QNN installation at ${QNN_INSTALLATION_DIR}" | ||
| rm -rf "${QNN_INSTALLATION_DIR}" | ||
| fi | ||
|
|
||
| mkdir -p "${QNN_INSTALLATION_DIR}" | ||
|
|
||
| QNN_ZIP_FILE="v${QNN_VERSION}.zip" | ||
| curl -Lo "/tmp/${QNN_ZIP_FILE}" "${QNN_ZIP_URL}" | ||
| echo "Finishing downloading qnn sdk." | ||
| unzip -qo "/tmp/${QNN_ZIP_FILE}" -d /tmp | ||
| echo "Finishing unzip qnn sdk." | ||
|
|
||
| # Print the content for manual verification | ||
| echo "Contents of /tmp/qairt:" | ||
| ls -lah "/tmp/qairt" | ||
|
|
||
| # Move the specific version directory | ||
| if [ -d "/tmp/qairt/${QNN_VERSION}" ]; then | ||
| mv "/tmp/qairt/${QNN_VERSION}" "${QNN_INSTALLATION_DIR}" | ||
| else | ||
| mv "/tmp/qairt"/* "${QNN_INSTALLATION_DIR}" | ||
| fi | ||
|
|
||
| echo "Finishing installing qnn '${QNN_INSTALLATION_DIR}' ." | ||
| echo "Final QNN installation contents:" | ||
| ls -lah "${QNN_INSTALLATION_DIR}" | ||
|
|
||
| # Set QNN_SDK_ROOT environment variable | ||
| export QNN_SDK_ROOT="${QNN_INSTALLATION_DIR}" | ||
| echo "Set QNN_SDK_ROOT=${QNN_SDK_ROOT}" | ||
| } | ||
|
|
||
| setup_libcpp() { | ||
| clang_version=$1 | ||
| LLVM_VERSION="14.0.0" | ||
| INSTALL_DIR="/tmp/libcxx-${LLVM_VERSION}" | ||
|
|
||
| # Check if we already have a local installation | ||
| if [ -d "${INSTALL_DIR}/include" ] && [ -d "${INSTALL_DIR}/lib" ]; then | ||
| echo "Local libc++ already installed at ${INSTALL_DIR} - skipping" | ||
| # Set environment variables | ||
| export CPLUS_INCLUDE_PATH="${INSTALL_DIR}/include:$CPLUS_INCLUDE_PATH" | ||
| export LD_LIBRARY_PATH="${INSTALL_DIR}/lib:$LD_LIBRARY_PATH" | ||
| export LIBRARY_PATH="${INSTALL_DIR}/lib:$LIBRARY_PATH" | ||
| return | ||
| fi | ||
|
|
||
| echo "Installing libc++ manually to ${INSTALL_DIR}" | ||
|
|
||
| # Create temporary directory | ||
| TEMP_DIR=$(mktemp -d) | ||
| # Ensure cleanup on exit or return | ||
| trap 'rm -rf "$TEMP_DIR"' RETURN | ||
|
|
||
| pushd "${TEMP_DIR}" >/dev/null | ||
|
|
||
| BASE_NAME="clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-18.04" | ||
| LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${BASE_NAME}.tar.xz" | ||
|
|
||
| echo "Downloading LLVM from ${LLVM_URL}" | ||
| curl -fLO "${LLVM_URL}" || { | ||
| echo "Error: Failed to download LLVM" | ||
| exit 1 | ||
| } | ||
|
|
||
| echo "Extracting ${BASE_NAME}.tar.xz" | ||
| tar -xf "${BASE_NAME}.tar.xz" || { | ||
| echo "Error: Failed to extract LLVM archive" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Create installation directory | ||
| mkdir -p "${INSTALL_DIR}/include" | ||
| mkdir -p "${INSTALL_DIR}/lib" | ||
|
|
||
| # Copy libc++ headers and libraries | ||
| cp -r "${BASE_NAME}/include/c++/v1/"* "${INSTALL_DIR}/include/" | ||
| cp -r "${BASE_NAME}/lib/"*.so* "${INSTALL_DIR}/lib/" | ||
|
|
||
| popd >/dev/null | ||
|
|
||
| # Create necessary symlinks locally | ||
| pushd "${INSTALL_DIR}/lib" >/dev/null | ||
| ln -sf libc++.so.1.0 libc++.so.1 | ||
| ln -sf libc++.so.1 libc++.so | ||
| ln -sf libc++abi.so.1.0 libc++abi.so.1 | ||
| ln -sf libc++abi.so.1 libc++abi.so | ||
| popd >/dev/null | ||
|
|
||
| # Set environment variables | ||
| export CPLUS_INCLUDE_PATH="${INSTALL_DIR}/include:$CPLUS_INCLUDE_PATH" | ||
| export LD_LIBRARY_PATH="${INSTALL_DIR}/lib:$LD_LIBRARY_PATH" | ||
| export LIBRARY_PATH="${INSTALL_DIR}/lib:$LIBRARY_PATH" | ||
|
|
||
| echo "libc++ installed to ${INSTALL_DIR}" | ||
| } | ||
|
|
||
| setup_libcpp 12 | ||
| setup_android_ndk | ||
| install_qnn | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| # QNN SDK Configuration | ||
| QNN_VERSION="2.28.0.241029" | ||
| QNN_ZIP_URL="https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v${QNN_VERSION}.zip" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.