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

Cannot Install on Macbook pro m1 #540

Closed
ghost opened this issue Mar 5, 2021 · 37 comments
Closed

Cannot Install on Macbook pro m1 #540

ghost opened this issue Mar 5, 2021 · 37 comments

Comments

@ghost
Copy link

ghost commented Mar 5, 2021

So I have a macbook pro m1 and i try to install fltk-rs
and the error i am getting is
` Compiling fltk v0.15.6
error: failed to add native library /Users/namorahimi/Documents/Visual Studio Projects/guessing_game/target/debug/build/fltk-sys-790e153c70300d52/out/build/libcfltk.a: file too small to be an archive

error: aborting due to previous error

error: could not compile fltk-sys

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
namorahimi@Namos-MacBook-Pro guessing_game % `

Does anybody have any idea ?

@MoAlyousef
Copy link
Collaborator

Hi
What's the content of the Cargo.toml. And what's the output of cargo build -vv ?

@ghost

This comment has been minimized.

@MoAlyousef
Copy link
Collaborator

And the content of the Cargo.toml?

@ghost
Copy link
Author

ghost commented Mar 5, 2021

here

[package]
name = "guessing_game"
version = "0.1.0"
authors = ["Gray-Zero Gray-Zero@users.noreply.github.com"]
edition = "2018"

See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8"
fltk = { version = "^0.15", git = "https://github.com/MoAlyousef/fltk-rs" }

@MoAlyousef
Copy link
Collaborator

Can you replace with:

fltk = "^0.15"

Run cargo clean then cargo build -vv

@ghost

This comment has been minimized.

@ghost

This comment has been minimized.

@MoAlyousef
Copy link
Collaborator

MoAlyousef commented Mar 5, 2021

I would say this is related to these issues:
rust-lang/cargo#8875, rust-lang/rust#50220 and rust-lang/rust#55235

How did you install your C/C++/Rust toolchains?
My last suggestion is to try:
fltk = { version = "^0.15", features = ["fltk-bundled"] }

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i do not fully understand what you mean by installing rust toolchains all i did for my installation of rust is

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh``` for installing rust

@MoAlyousef
Copy link
Collaborator

Is the C/C++ toolchain the default installed by XCode?

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i had xcode but i deleted it because it took to much space but i can install it

@MoAlyousef
Copy link
Collaborator

MoAlyousef commented Mar 5, 2021

Try first:
fltk = { version = "^0.15", features = ["fltk-bundled"] }

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i did that it did not work

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i am gonna install xcode

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i still get the error

@eadf
Copy link
Contributor

eadf commented Mar 5, 2021

Did you try to build with the M1 toolchain?
rustup toolchain install stable-aarch64-apple-darwin
rustup toolchain install nightly-aarch64-apple-darwin
rustup toolchain default nightly-aarch64-apple-darwin
You will also need the Xcode command line utils
xcode-select --install

@ghost
Copy link
Author

ghost commented Mar 5, 2021

@eadf your rustup toolchain default nightly-aarch64-apple-darwin is wrong

@ghost
Copy link
Author

ghost commented Mar 5, 2021

i already have xcode-select --install that installed
i already done it before

@ghost
Copy link
Author

ghost commented Mar 5, 2021

like i did rustup toolchain install nightly-aarch64-apple-darwin this and it installed but currently i am trying to do this rustup toolchain default nightly-aarch64-apple-darwin but it gives me this error
``namorahimi@Namos-MacBook-Pro guessing_game % rustup toolchain default nightly-aarch64-apple-darwin
error: Found argument 'default' which wasn't expected, or isn't valid in this context

USAGE:
rustup toolchain

For more information try --help
namorahimi@Namos-MacBook-Pro guessing_game % ``

@eadf
Copy link
Contributor

eadf commented Mar 5, 2021

ah, my bad - just use
rustup default nightly-aarch64-apple-darwin

@ghost
Copy link
Author

ghost commented Mar 5, 2021

still same error with that commands i used i installed this rustup toolchain install nightly-aarch64-apple-darwin
and same error this is very weird

@MoAlyousef
Copy link
Collaborator

MoAlyousef commented Mar 5, 2021

It might be defaulting to the old C/C++ toolchain. What's the output of

ls -la `which c++`

@eadf
Copy link
Contributor

eadf commented Mar 5, 2021

When you build with nightly-aarch64, can you still see x86_64 in the build logs?
My rust environment only uses the native M1 toolchain, and it builds fltk without any problems.
Maybe you could try to remove the x86 rust toolchains?

@ghost
Copy link
Author

ghost commented Mar 5, 2021

@MoAlyousef this is what it shows
namorahimi@Namos-MacBook-Pro guessing_game % ls -la which c++
-rwxr-xr-x 1 root wheel 137552 1 Jan 2020 /usr/bin/c++
namorahimi@Namos-MacBook-Pro guessing_game %

@ghost
Copy link
Author

ghost commented Mar 5, 2021

@eadf how do i remove x86 rust toolchains

@eadf
Copy link
Contributor

eadf commented Mar 5, 2021

rustup toolchain list

My rust toolchain list only contains:

stable-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default)

To remove an unwanted toolchain

rustup uninstall [whatever name you find in the list]

And just to make sure, try

 /usr/bin/c++ --version

my version is:

Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@MoAlyousef
Copy link
Collaborator

MoAlyousef commented Mar 5, 2021

I've hidden the long comments containing the build logs to reduce scrolling.

@ghost
Copy link
Author

ghost commented Mar 5, 2021

thanks @MoAlyousef

This is my thing @eadf

namorahimi@Namos-MacBook-Pro guessing_game % rustup toolchain list
stable-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default)
namorahimi@Namos-MacBook-Pro guessing_game % /usr/bin/c++ --version
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
namorahimi@Namos-MacBook-Pro guessing_game % xcode-select --install
xcode-select: note: install requested for command line developer tools
namorahimi@Namos-MacBook-Pro guessing_game % /usr/bin/c++ --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
namorahimi@Namos-MacBook-Pro guessing_game %

@eadf
Copy link
Contributor

eadf commented Mar 5, 2021

That 'xcrun: error: ...' could explain those zero size archives. Does the build problem persist after you re-installed the Xcode command line?
Have you tried to use any other compiled c/c++ rust crate?

@ghost
Copy link
Author

ghost commented Mar 6, 2021

@eadf no but i did xcode-select --install and it worked and i have not tried c ++ other crates what do you recommend

@eadf
Copy link
Contributor

eadf commented Mar 6, 2021

Just to try to narrow down the problem you could try to build another obj-c/c/c++ crate like this:

git  clone https://github.com/servo/core-foundation-rs.git --depth=1
cd core-foundation-rs
cargo run --example tab_view

@ghost
Copy link
Author

ghost commented Mar 6, 2021

sure

@ghost
Copy link
Author

ghost commented Mar 6, 2021

@eadf that works
fully hmm

@ghost
Copy link
Author

ghost commented Mar 6, 2021

well that works when i do cargo build again new error in a new format

`` --- stderr
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
CMake Deprecation Warning at fltk/CMakeLists.txt:25 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.

In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.c:19:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:87:13: warning: 'strlcat' macro redefined [-Wmacro-redefined]

define strlcat fl_strlcat

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:118:9: note: previous definition is here
#define strlcat(dest, ...)
^
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.c:19:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:92:13: warning: 'strlcpy' macro redefined [-Wmacro-redefined]

define strlcpy fl_strlcpy

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:111:9: note: previous definition is here
#define strlcpy(dest, ...)
^
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/vsnprintf.c:20:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:87:13: warning: 'strlcat' macro redefined [-Wmacro-redefined]

define strlcat fl_strlcat

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:118:9: note: previous definition is here
#define strlcat(dest, ...)
^
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/vsnprintf.c:20:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:92:13: warning: 'strlcpy' macro redefined [-Wmacro-redefined]

define strlcpy fl_strlcpy

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:111:9: note: previous definition is here
#define strlcpy(dest, ...)
^
2 warnings generated.
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.c:19:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:87:13: warning: 'strlcat' macro redefined [-Wmacro-redefined]

define strlcat fl_strlcat

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:118:9: note: previous definition is here
#define strlcat(dest, ...)
^
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.c:19:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:92:13: warning: 'strlcpy' macro redefined [-Wmacro-redefined]

define strlcpy fl_strlcpy

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:111:9: note: previous definition is here
#define strlcpy(dest, ...)
^
2 warnings generated.
2 warnings generated.
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/vsnprintf.c:20:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:87:13: warning: 'strlcat' macro redefined [-Wmacro-redefined]

define strlcat fl_strlcat

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:118:9: note: previous definition is here
#define strlcat(dest, ...)
^
In file included from /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/vsnprintf.c:20:
/Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/fltk-sys-0.5.12/cfltk/fltk/src/flstring.h:92:13: warning: 'strlcpy' macro redefined [-Wmacro-redefined]

define strlcpy fl_strlcpy

          ^

/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/secure/_string.h:111:9: note: previous definition is here
#define strlcpy(dest, ...)
^
2 warnings generated.
/Library/Developer/CommandLineTools/usr/bin/ranlib: for architecture: x86_64 file: /Users/namorahimi/Documents/Visual Studio Projects/guessing_game/target/debug/build/fltk-sys-04730562a523930d/out/lib/libfltk.a(Fl_Help_Dialog_Dox.cxx.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: for architecture: x86_64 file: /Users/namorahimi/Documents/Visual Studio Projects/guessing_game/target/debug/build/fltk-sys-04730562a523930d/out/lib/libfltk.a(fl_overlay_visual.cxx.o) has no symbols
Undefined symbols for architecture arm64:
"_png_do_expand_palette_rgb8_neon", referenced from:
_png_do_read_transformations in libfltk_png.a(pngrtran.c.o)
"_png_do_expand_palette_rgba8_neon", referenced from:
_png_do_read_transformations in libfltk_png.a(pngrtran.c.o)
"_png_init_filter_functions_neon", referenced from:
_png_read_filter_row in libfltk_png.a(pngrutil.c.o)
"_png_riffle_palette_neon", referenced from:
_png_do_read_transformations in libfltk_png.a(pngrtran.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [fltk/bin/fluid.app/Contents/MacOS/fluid] Error 1
make[1]: *** [fltk/fluid/CMakeFiles/fluid.dir/all] Error 2
make: *** [all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', /Users/namorahimi/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
namorahimi@Namos-MacBook-Pro guessing_game % ``

@eadf
Copy link
Contributor

eadf commented Mar 6, 2021

Could be that there is a local file corruption in your rust installation or at /Users/namorahimi/Documents/Visual Studio Projects/guessing_game

You could try any of the flkt examples.
If that doesn't work I'd uninstall and reinstall rust from scratch.

Hm.. it seems like x86_64 is still being built. Are you using a x86 terminal or shell?

@ghost
Copy link
Author

ghost commented Mar 6, 2021

i am not sure about the terminal fully
the fltk examples do work

@ghost
Copy link
Author

ghost commented Mar 6, 2021

i have fixed my problem its vscode on my terminal it works fully thanks !!!!

@ghost ghost closed this as completed Mar 6, 2021
This issue was closed.
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

2 participants