sudipghimire533 / ytui-music

Youtube client in terminal for music ( lightweight youtube client )
GNU General Public License v2.0
467 stars 19 forks source link

Compile Issue #8

Open rohitjakhar opened 2 years ago

rohitjakhar commented 2 years ago

= 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

sudipghimire533 commented 2 years ago

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?

elliot0319 commented 2 years ago

I tried to compile on Mac. It says something like this. error: linking withcc` 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`

mark2185 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.
sudipghimire533 commented 2 years ago

@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

ghost commented 2 years ago

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

mark2185 commented 2 years ago

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

ghost commented 2 years ago

@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?

mark2185 commented 2 years ago

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.

ghost commented 2 years ago

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.

mark2185 commented 2 years ago

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?

ghost commented 2 years ago

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

sudipghimire533 commented 2 years ago

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

theherk commented 1 year ago

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.