Haxe: rebuild hxcpp failed with Error: Could not find build target "std" - haxe

Trying to rebuild hxcpp failed with the cryptic error message:
Error: Could not find build target "std"

Some users report this hint (I swear I didn't see it when I hit the issue, unless I'm just blind):
Have you tried rebuilding the hxcpp.n and build.n scripts?
This is done by running haxe in the tools/hxcpp and tools/build directories.
Hence:
cd hxcpp/tools/hxcpp
haxe compile.hxml
cd ../build
haxe compile.hxml
Fixes it.
Also note that nightly hxcpp builds are available from nmehost.com and openfl.org if you just need a newer version than what's available via haxelib.

Related

Rust-analyzer failed to load workspace

rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.tml file /home/eth/Downloads/testing/Cargo.toml, cargo 1.33.0-nightly (0d1f1bbea 2018-12-19): Failed to run '"cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/eth/Downloads/testing/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu"': 'cargo metadata' exited with an error: error: Found argument '--filter-platform' which wasn't expected, or isn't valid in this context
I needed to reinstall my OS few days back, and when I installed and configured my plugins in NeoVim - CoC is being used for code suggestion -, that error came out. I believe that's not a NeoVim/CoC problem, that's why I tagged it so. I don't have much experience dealing with that kinda stuff, so I don't even know what else information I could provide...
Update Rust.
rust-analyzer invokes the command cargo metadata with the flag --filter-platform. This flag was added in Rust 1.41.0. Since you're using an older Rust version (1.33.0), Cargo complains.

How do I fix "ld: error: unable to find library -lgcc" when cross-compiling rust to android?

I'm trying to get rust working on android. However, when I try to cross-compile to android I get the following linking error:
$ cargo build --target=arm-linux-androideabi
Compiling <project> v0.1.0 (<project>)
error: linking with `/opt/android-sdk/ndk/23.0.7599858/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi31-clang` failed: exit status: 1
(very long toolchain command from cargo)
ld: error: unable to find library -lgcc
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
I have installed the ndk and changed the linker in .cargo/config to the android clang linker. I also tried the standalone toolchains with the same result. The guide I used was the following: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html
Cross-compilation does work when using crate-type = ["rlib"] instead of crate-type = ["cdylib"], but I need an .so file not an .rlib file.
In case it's relevant, i'm using Manjaro Linux.
UPDATE:
I found the following pull request: https://github.com/rust-lang/rust/pull/85806 After switching to ndk22 it worked. I havn't tried if the pull request fixes the issue (probably does).
Without switching to an older NDK version, I found using the workaround provided by ssrlive to work for me. Here's their comment:
Fixing build error for NDK 23 and above
find out all the 4 folders containing file libunwind.a, in my PC,
it's
C:\Users\Administrator\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\12.0.8\lib\linux\x86_64\
and more. create 4 text files named libgcc.a in the same folders
with this contents
INPUT(-lunwind)
reference
link
In macOS, the paths are
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/Library/Android/sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
In Linux, the paths are
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
~/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
In Windows, the paths are
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/aarch64/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/arm/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/i386/libunwind.a
~/AppData/Local/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/14.0.1/lib/linux/x86_64/libunwind.a
create file command in Linux/macOS
cat << EOF > libgcc.a
INPUT(-lunwind)
EOF
This is of course extremely brittle and not the "right" solution, but the workaround works fine as of 2022-10-12 with ndk version 25.1.8937393.

Error: "linker 'cc' not found" when cross compiling a rust project from windows to linux using cargo

I have a basic rust/cargo project with a single main file and some basic dependencies. The cargo build command works fine when the target is not specified (I am using windows so it builds to windows), but when I try to cross compile the program to linux using cargo build --target=x86_64-unknown-linux-gnu or cargo build --target=x86_64-unknown-linux-musl, the process fails with the following error: linker 'cc' not found.
Does anyone have an idea how to get around this? Is there a specific linker I need to install?
Thanks.
I've just figured it out.
It turns out you need to tell cargo to use the LLVM linker instead. You do this by creating a new directory called .cargo in your base directory, and then a new file called config.toml in this directory. Here you can add the lines:
[target.x86_64-unknown-linux-musl]
rustflags = ["-C", "linker-flavor=ld.lld"]
Then building with the command cargo build --target=x86_64-unknown-linux-musl should work!

Cannot use cargo uninstall to uninstall packages in ~/.cargo: package id specification matched no package

I'm having trouble uninstalling Cargo-installed packages from my system.
There are packages like rand-0.3.22 that are obviously installed under $HOME/.cargo
ls ~/.cargo/registry/src/github.com-1ecc6299db9ec823/ra
racer-2.0.14/ rand-0.3.22/ rand-0.4.2/
rand-0.4.3/ rand-0.5.5/ rand_core-0.2.1/
rawpointer-0.1.0/ rayon-1.0.2/ rayon-core-1.4.1/
This can also be verified by using cargo pkgid
cargo pkgid -p rand
error: There are multiple `rand` packages in your project, and the specification `rand` is ambiguous.
Please re-run this command with `-p <spec>` where `<spec>` is one of the following:
rand:0.5.5
rand:0.4.3
rand:0.3.22
However, I'm unable to remove that package with cargo uninstall. None of these seem to work:
cargo uninstall rand
cargo uninstall -- rand:0.4.3
cargo uninstall https://github.com/rust-lang/crates.io-index#rand:0.4.3
For any of the commands above I get:
error: invalid package id specification: <name-of-package-i-specified>
This seems like a rather basic operation so I suspect it's something fundamental to how cargo-uninstall is to be used.
Any pointers?
cargo uninstall undoes the effect of cargo install. You did not cargo install rand, because it is just a library, not an executable program. That means it was not installed.
The ~/.cargo/registry is just a cache of build dependencies. Feel free to wipe it anytime; cargo will re-download and re-build whatever it needs when it does.
Yes, it is wrong. Cargo should be using .local, .config and .cache as appropriate; then it would be obvious what you can just clean up. Using arbitrary dot-dirs is an insult at this day and age. It was reported, several times probably. Nobody got around to fixing it yet.

Cannot install accelerate-cuda in Haskell

I am on a linux box and trying to experiment with Haskell's Accelerate library but having problems installing it. I have successfully installed the accelerate package but there seems to be a dependency problem, which I have detailed below.
cabal: Error: some packages failed to install:
accelerate-cuda-0.14.0.0 depends on haskell-src-exts-1.14.0.1 which failed to
install.
cuda-0.5.1.1 failed during the configure step. The exception was:
ExitFailure 1
haskell-src-exts-1.14.0.1 failed during the configure step. The exception was:
ExitFailure 1
haskell-src-meta-0.6.0.5 depends on haskell-src-exts-1.14.0.1 which failed to
install.
language-c-quote-0.7.6 depends on haskell-src-exts-1.14.0.1 which failed to
install.
I searched SO and noticed someone else had a similiar issue installed the cuda package, and was resolved by adding the cabal bin path to the PATH; I tried this but it didn't solve this problem.
Please could someone help as I really keen to play with this fantastic library.
I wanted to check accelerate-examples and play with them and I also didn't have CUDA GPU (AMD only) and that's how I eventually installed accelerate-examples with stack:
git clone https://github.com/AccelerateHS/accelerate-examples
cd accelerate-examples
#choose version:
ln stack-8.6.yaml stack.yaml
#build without CUDA targeting:
stack build --flag accelerate-examples:-llvm-ptx --flag accelerate-fft:-llvm-ptx
Installation will build all the examples and print the info regarding where they was put.
Might also need to specify GHC libs path with something like: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5/rts/
Also checked that accelerate installs as well the same way but even without specifying any flags (I guess because it doesn't build any programs yet?), but examples are what's fun :)
P.S. You can move llvm-ptx flags to stack.yaml config: change # flags: {} line to:
flags:
accelerate-fft:
llvm-ptx: false
accelerate-examples:
llvm-ptx: false

Resources