-
Notifications
You must be signed in to change notification settings - Fork 147
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
no such module 'ArgumentParser' #499
Comments
It's not working. |
confirmed not working under latest "Big Sur" + xcode 12.3 |
I finally find a way to build successfully on macOS 11.2.2 with Xcode 12.4. STEP 1Run commands as follows in
now we have STEP 2Modify comment following lines at 74 and 75
add line after
change line 80 as follows
save file. STEP 3run command
Now we got the build app in derived data folder. The root cause of failure while building is because the build-rust-xcode.sh is always error. So instead running it, I run the command mannually in terminal and leave a little command in it to run so will not break the xcode build phases. |
@Lyrillind I failed at Step 3 with the following error:
I'm using macOS 11.2.3 with Xcode 12.4. This is my #!/bin/bash
# When building from Xcode we want to ensure that `cargo` is in PATH.
# as a convenience, add the default cargo install location
export PATH="$PATH:${HOME}/.cargo/bin"
# Users can optionally set cargo path in xi-mac/.env
if [[ -f "${SRCROOT}/.env" ]]; then
source "${SRCROOT}/.env"
if ! [[ -z "$CARGO_PATH" ]]; then
export PATH="$CARGO_PATH:$PATH"
else
echo "warning: ${SRCROOT}/.env file found, but CARGO_PATH not set."
fi
fi
if ! [[ -x "$(command -v cargo)" ]]; then
echo 'error: Unable to find cargo command. If cargo is not installed visit rustup.rs, otherwise set CARGO_PATH in xi-mac/.env' >&2
exit 127
fi
set -e
function build_target () {
TARGET_NAME="$1"
CARGO_PROJECT_FLAG="$2"
cd "${SRCROOT}/xi-editor/rust"
if [[ ${ACTION:-build} = "build" ]]; then
if [[ $PLATFORM_NAME = "" ]]; then
# default for building with xcodebuild
PLATFORM_NAME="macosx"
fi
if [[ $PLATFORM_NAME = "macosx" ]]; then
RUST_TARGET_OS="darwin"
else
RUST_TARGET_OS="ios"
fi
for ARCH in $ARCHS
do
if [[ $(lipo -info "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}" 2>&1) != *"${ARCH}"* ]]; then
rm -f "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}"
fi
done
if [[ $CONFIGURATION = "Debug" ]]; then
RUST_CONFIGURATION="debug"
RUST_CONFIGURATION_FLAG=""
else
RUST_CONFIGURATION="release"
RUST_CONFIGURATION_FLAG="--release"
fi
EXECUTABLES=()
for ARCH in $ARCHS
do
RUST_ARCH=$ARCH
if [[ $RUST_ARCH = "arm64" ]]; then
RUST_ARCH="aarch64"
fi
cargo build $RUST_CONFIGURATION_FLAG $CARGO_PROJECT_FLAG --target "${RUST_ARCH}-apple-${RUST_TARGET_OS}"
EXECUTABLES+=("target/${RUST_ARCH}-apple-${RUST_TARGET_OS}/${RUST_CONFIGURATION}/${TARGET_NAME}")
done
mkdir -p "${BUILT_PRODUCTS_DIR}"
xcrun --sdk $PLATFORM_NAME lipo -create "${EXECUTABLES[@]}" -output "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}"
elif [[ $ACTION = "clean" ]]; then
cargo clean
rm -f "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}"
fi
}
# build_target xi-core ""
# build_target xi-syntect-plugin "-p xi-syntect-plugin"
# move syntect plugin into plugins dir
mkdir -p "${BUILT_PRODUCTS_DIR}/plugins/syntect/bin"
mv "xi-syntect-plugin" "${BUILT_PRODUCTS_DIR}/plugins/syntect/bin/"
cp "${SRCROOT}/xi-editor/rust/syntect-plugin/manifest.toml" "${BUILT_PRODUCTS_DIR}/plugins/syntect/"
# workaround for https://github.com/travis-ci/travis-ci/issues/6522
set +e
|
|
In case anyone else is unfamiliar with what this means it's in (at least for me) |
run this work for me, macOS 11.2.3; Xcode 12.5.1 |
Thanks, that worked for me (had to reinstall arm64 Rust on M1). |
/Users/xuwei/Desktop/xi-mac/Sources/XiCLICore/Xi.swift:15:8: error: no such module 'ArgumentParser'
import ArgumentParser
^
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
The text was updated successfully, but these errors were encountered: