-
Notifications
You must be signed in to change notification settings - Fork 418
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
Undefined symbol: _new_tunnel #397
Comments
InvestigationFollowing up on my own issue, after a lot of digging and testing, I realized that the command line to build the library, which was provided in the README.md, is the issue. The command line specifies --no-default-features, which disables most of the code for the library. In fact, the Cargo.toml includes an empty Default feature definition anyway, so with or without the command line option, the resulting library would be unusable. I believe the correct command line for building for an iPhone is:
Obviously, if you were building for a different platform which required the JNI bindings you would need to include that in the feature list as well. ConclusionThis is a documentation bug and should be resolved to prevent this issue for others. I admit that my knowledge of Cargo at the start of this was quite limited, so I was relying heavily on the README.md and the information available in the repository. Having dug a little deeper into the package manger, I realized that no features were enabled by default and in fact the resulting library contained virtually no Wireguard code. Why the code was shipped this way is a bit of a mystery to me. It seems like adding a minimal set of features to the Default feature and removing the --no-default-features flag from the documentation would be a good solution here. Other useful informationAs a side note, it is probably also worth mentioning that the nm included with the XCode command line tools does not appear compatible with the object format produced by the Rust LLVM. That leads to a lot of errors and missing symbols when dumping the library contents. For example:
I found that Objdump was able to dump the library without issues.
I also found the binutils, available from Homebrew, provided a usable nm. I was able to use gnm to successfully dump the contents of the library. This can be installed and used with the following commands.
|
Good morning everyone.
I am hoping this is a simple issue and someone can help me out. I have spent a lot of time searching for a solution without any luck.
Summary
I have created a static library using the instructions in the repository for the target triple aarch64-apple-ios. The library built without issues. However, when I try to compile the project using the library, I get this error: "Undefined symbol: _new_tunnel". As the library is properly added to my project and the required "bridging header" is correct, I used nm to look at the library and discovered that, in fact, the symbol is not in the library.
What can cause this issue and how can I produce a library which contains the necessary exports to use the library?
Details
Although I have built a version of the library for more than one target triple, let's focus on the aarch64-apple-ios case for the moment. I have installed rustup and have the following versions installed.
I have also installed the target using rustup.
Then, I built the library using the command from the README.md, which was:
This builds and produces the static and dynamic libraries as expected. Using the nm command on the resulting library, I see the following information (excerpt, but includes the only reference to boringtun as the rest are the many dependencies of the project).
I am unclear why none of the symbols I expected are present. To ensure there was not an issue with my setup, I installed a sample project that generates a simple static library and verified that after building it, the symbols that I expected to be present were in fact in the library.
The text was updated successfully, but these errors were encountered: