Skip to content
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

Compile Issue #8

Open
rohitjakhar opened this issue Feb 27, 2022 · 15 comments
Open

Compile Issue #8

rohitjakhar opened this issue Feb 27, 2022 · 15 comments

Comments

@rohitjakhar
Copy link

= 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
Copy link
Owner

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:

- name: Install dependencies

Mac:

- name: Install dependencies

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

@elliot0319
Copy link

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`

@mark2185
Copy link
Contributor

mark2185 commented May 12, 2022

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Owner

sudipghimire533 commented May 16, 2022

@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
Copy link

ghost commented Jul 2, 2022

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

@mark2185
Copy link
Contributor

mark2185 commented Jul 2, 2022

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

@ghost
Copy link

ghost commented Jul 2, 2022

@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
Copy link
Contributor

mark2185 commented Jul 2, 2022

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
Copy link

ghost commented Jul 2, 2022

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
Copy link
Contributor

mark2185 commented Jul 2, 2022

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
Copy link

ghost commented Jul 2, 2022

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
Copy link
Owner

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

@theherk
Copy link

theherk commented Aug 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@theherk @mark2185 @rohitjakhar @sudipghimire533 @elliot0319 and others