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

Compiling macOS environment on Ubuntu 22.04 #887

Open
BlockGardener opened this issue Mar 15, 2023 · 2 comments
Open

Compiling macOS environment on Ubuntu 22.04 #887

BlockGardener opened this issue Mar 15, 2023 · 2 comments

Comments

@BlockGardener
Copy link

I have an issue compiling the macOS environment for Litecoin 0.21.2.2 on Ubuntu 22.04.

I installed the following dependencies:

sudo apt-get install make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3 patch
sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5

The following commands where executed to compile the macOS environment after I created the file Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz with Xcode 3.1.1:

./contrib/macdeploy/gen-sdk $HOME'/Xcode.app'
mkdir -p depends/sdk-sources
mkdir -p depends/SDKs
cp Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz depends/sdk-sources
tar -C depends/SDKs -xf depends/sdk-sources/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz

cd depends
make HOST=x86_64-apple-darwin18

The compiling results in the following errors:

[ 21%] Building CXX object test/CMakeFiles/assert-test.dir/assert-test.cc.o
[ 23%] Linking CXX executable ../bin/assert-test
clang: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
ld: building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 )
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test/CMakeFiles/assert-test.dir/build.make:100: bin/assert-test] Error 1
make[2]: *** [CMakeFiles/Makefile2:233: test/CMakeFiles/assert-test.dir/all] Error 2

@losh11
Copy link
Member

losh11 commented May 9, 2023

When compiling for a different target OS, I would strongly reccomend doing a gitian-build with docker. Dependencies and build tools can be extremely hard to get right.

@DaCryptoRaccoon
Copy link

It appears that you are encountering linker errors.

The specific error message you are seeing:

ld: building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 )

clang: error: linker command failed with exit code 1 (use -v to see invocation)

This error indicates that the linker is attempting to link with a file that is not compatible with the macOS-x86_64 target architecture.

To troubleshoot and resolve this issue, consider the following steps:

Check Dependencies and Configuration:
Ensure that all required dependencies are properly installed and configured. Double-check that you have followed the installation instructions accurately, including downloading and extracting the correct SDK.

SDK Compatibility:
Verify that the Xcode SDK you have extracted is compatible with the macOS-x86_64 target architecture. It's possible that the extracted SDK is not suitable for linking with the Litecoin source code.

Check Makefile and Compiler Flags:
Review the Makefile and any compiler/linker flags that are being used. Make sure that the correct flags and settings are being passed to the compiler and linker for the macOS-x86_64 target.

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

3 participants