Here is a comprehensive article about Ethereum API compilation error on Binance:
Ethereum API compilation error on Binance with Swift 4 and XCode
I am getting an error when trying to compile my Ethereum API project using Swift 4 and XCode on macOS 10.13/10.14. The issue is related to the Binance API that I have integrated into my project.
Subject:
The issue occurs when I try to compile a new file in the project directory. When the « swift build » command is executed, it gives an error message pointing to the following line:
/bin/ld: -lbinanceapi not found
This indicates that the Binance API is not linked correctly.
README file:
I have checked the official Binance API Swift 4 README file and the instructions seem to be correct. Here is a summary of what I did:
- Created an Xcode project with a new Swift package called « BinanceApi ».
- Added the necessary import statements for the Binance API.
- Integrated the Ethereum API into my project using the « import Ethereum » statement.
XCode Build Settings:
I have added the following build settings to my XCode project settings:
OTHER_LDFLAGS
:-lEthereum
- « BinanceAPI_KEY »: « YOUR_API_KEY_HERE »
- « BinanceAPI_SECRET »: « YOUR_API_SECRET_HERE »
However, I have noticed that some of these flags are missing or not present at all. This indicates that the XCode build process is trying to link to a different library than what I have specified.
Solution:
To resolve this issue, I recommend checking the following:
- Make sure you have added the Binance API to your project’s Swift Package Manager (SPM) by running the command ‘swift package add BinanceApi’.
- Make sure you are using the correct version of the Ethereum library and its dependencies.
- Make sure XCode is configured to link to the correct library.
Additional Tips:
- Make sure your « Xcode Settings » are configured correctly for building a new project with Swift 4.
- Use the XCode Command-Line Tool (CCT) or Xcode Organizer to build and run the project, as this can help identify any issues that are not in the XCode project settings.
Conclusion:
After troubleshooting, I believe it is due to several factors:
- The Binance API is not linked correctly.
- Flags OTHER_LDFLAGS are missing or invalid.
I hope this helps you resolve your Ethereum API compilation error on Binance with Swift 4 and XCode. If the issues persist, please provide more details about the log output as it may help identify the root cause of the issue.