ytui-music icon indicating copy to clipboard operation
ytui-music copied to clipboard

Compile Issue

Open rohitjakhar opened this issue 3 years ago • 15 comments

= help: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified = note: use the -l flag to specify native libraries to link = note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile ytui_music due to previous error

rohitjakhar avatar Feb 27 '22 08:02 rohitjakhar

Which platform you are trying to compile on. If windows, I am also bit unsure and if in mac/linux then can you please refer to Linux: https://github.com/sudipghimire533/ytui-music/blob/3415c4844e8c34815810d773a7eb8b29e5b1d90e/.github/workflows/release-action.yml#L28

Mac: https://github.com/sudipghimire533/ytui-music/blob/3415c4844e8c34815810d773a7eb8b29e5b1d90e/.github/workflows/release-action.yml#L100

Installing mpv dev-dependencies might solve this. Give me an update after trying this ok?

sudipghimire533 avatar Feb 27 '22 11:02 sudipghimire533

I tried to compile on Mac. It says something like this. error: linking with cc` failed: exit status: 1 | = note: "cc" "-arch" "arm64" "/Users/daeyeongkwun/ytui-music/target/release/deps/ytui_music-91d865fe58d526f7.ytui_music.25d64003-cgu.7.rcgu.o" "-L" "/Users/daeyeongkwun/ytui-music/target/release/deps" "-L" "/Users/daeyeongkwun/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/daeyeongkwun/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-4b0e4c844ac47183.rlib" "-lmpv" "-framework" "Security" "-framework" "CoreFoundation" "-lsqlite3" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/daeyeongkwun/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/daeyeongkwun/ytui-music/target/release/deps/ytui_music-91d865fe58d526f7" "-Wl,-dead_strip" "-nodefaultlibs" = note: ld: library not found for -lmpv clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile ytui_music due to previous error`

elliot0319 avatar May 12 '22 17:05 elliot0319

It looks like you're missing libmpv or whatever it's called on macOS.

Could you try installing mpv with brew and then try again?

mark2185 avatar May 12 '22 19:05 mark2185

It would seem you're missing mpv, ntdll and sqlite3 libraries. Try to find how to install them via choco or something.

NOTE: the mpv package you installed is maybe a binary executable and doesn't provide the necessary library files.

mark2185 avatar May 16 '22 10:05 mark2185

Is the error the same after running choco install sqlite?

The link says:

This package also installs sqlite tools by default - sqldiff, sqlite3, sqlite3_analyzer.

mark2185 avatar May 16 '22 12:05 mark2185

@BlakeZehner and @mark2185 . I was also unable to compile on windows. If you guys figure out what is the problem please let me know too. ( That is also the reason there is no windows binary in release ) I am unable to look into windows specific problems as I do not have any windows machine

sudipghimire533 avatar May 16 '22 16:05 sudipghimire533

On arch Linux is not working. I downloaded ytui_music-linux-amd64 and make it executable, but it does not run... any idea?

ghost avatar Jul 02 '22 11:07 ghost

@bambirombi what happens when you run it? Any error code, error message? Could you try building it from the source?

mark2185 avatar Jul 02 '22 12:07 mark2185

@mark2185 when I try to run it gives me this: zsh: command not found: ytui_music

Now I have tried: (I had rust installed) git clone https://github.com/sudipghimire533/ytui-music.git cargo build --all --release

But I do not understand this step: The compiled binary is located in target/release/ directory. Copy the ytui_music binary and place it somewhere where it is easy to run. Preferrably under $PATH. So I have to download ytui_music-linux-amd64 and place where exactly?

ghost avatar Jul 02 '22 12:07 ghost

The PATH variable is a list of folders where linux will search for the typed command, in this case it is ytui_music-linux-amd64.

You need to put the binary into one of those folders, or create a new one and update your PATH. I guess the easiest thing would be to:

$> mkdir ~/bin
$> mv /path/to/downloaded/ytui_music-linux-amd64 ~/bin/ytui_music
$> echo "export PATH=$HOME/bin:$PATH" >> ~/.zshrc
$> source ~/.zshrc

This will move the binary to ~/bin and rename it to ytui_music, and add that folder to your PATH. By adding that export PATH... line to your zshrc, it will run every time you spawn a new zsh. And to make update it in the current terminal, you need to source the zshrc file.

mark2185 avatar Jul 02 '22 12:07 mark2185

This steps does not work mv /path/to/downloaded/ytui_music-linux-amd64 ~/bin/ytui_music Gives: No such file or directory

Is anyway of doing this manually, I mean, without using the terminal?

So instead of that I tried moving "ytui_music-linux-amd64" to the bin folder but does not work.

ghost avatar Jul 02 '22 12:07 ghost

This steps does not work mv /path/to/downloaded/ytui_music-linux-amd64 ~/bin/ytui_music Gives: No such file or directory

This was just a placeholder, you need to write the actual path to the downloaded binary. Something like /home/bambirombi/Downloads/ytui_music-linux-amd64?

Is anyway of doing this manually, I mean, without using the terminal?

Well yes, you could use your file explorer if you'd like.

So instead of that I tried moving "ytui_music-linux-amd64" to the bin folder but does not work.

What exactly does "does not work" mean? Does it print out an error, does it explode, or something else?

mark2185 avatar Jul 02 '22 12:07 mark2185

Thanks!!! It worked. Thanks for your patience. So: git clone https://github.com/sudipghimire533/ytui-music.git cargo build --all --release

mkdir ~/bin then move ytui_music-linux-amd64 as ytui_music to the created "bin" folder. echo "export PATH=$HOME/bin:$PATH" >> ~/.zshrc source ~/.zshrc

ytui_music run

ghost avatar Jul 02 '22 12:07 ghost

@mark2185 Thanks for help buddy, I really appreciate it. And @bambirombi welcome to ytui- ;*

sudipghimire533 avatar Jul 02 '22 14:07 sudipghimire533

For anybody receiving this compiler error when attempting to build on M1 or M2 MacOS:

error: linking with `cc` failed: exit status: 1
...
  = note: ld: library not found for -lmpv

the likely solution you require is:

export LIBRARY_PATH=/opt/homebrew/lib

or:

export LIBRARY_PATH=/opt/homebrew/lib:$LIBRARY_PATH

if you already have others.

Homebrew installs libraries on M1 MacOS to a different location it seems, but the build works after this is set. This topic is discussed in further detail; Homebrew/brew#13481.

theherk avatar Aug 21 '22 12:08 theherk