-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
How can I link a .so file that is a shared library? #16592
Comments
I think that
I cannot seem to find the source to |
@ancientstraits Thank you for your interest.
I would be very grateful if you could let me know if you have any information. |
In order to compile the file, @jyh7a, you need to be in the directory of its source code. This is probably the root of a Git repository, and has a However, I think that you don't have the source code, since the company just sent you the ELF library with nothing else. I would see if their website has info on the library, and if there is a source code repository. If not, then you should contact them asking for the source code. Explain that the source code is needed in order to compile the library to WebAssembly to use it in a web browser. Right now, I don't think it's possible to go from an ELF to WebAssembly, perhaps because ELF is made for a desktop, while WebAssembly is made for the web. So either you or the company should compile to wasm, or your wasm application will not be able to use |
@jyh7a I think it would be a good idea to have |
@ancientstraits Thank you very much for your answer. I don't know how it was built because I only got the libMagicCrypto.so file from another company. I searched to see if I could use c files in nodejs.
Thanks for the always good info. |
@jyh7a Even if you could use the C file in node.js (which is probably possible), node.js is still a server application, meaning you would have to run it on a server. However, there might still be a small bit of hope. A decompiler turns binary into source code. Although there are not many C decompilers out there, you should research them and give some a try. If even that does not work, then what you are trying to do with your constraints (use a library without source code in a web browser) is impossible. If the company asked you to do just that, you will have to tell them that it is impossible without the source code. Also, you should look for extra information in the email in which the company shared the library with you. Does it reference any external names? Do those names lead to source code? |
@ancientstraits Thank you so much for all the help! Unfortunately, we don't have the c file that made the shared library. I didn't know much about emscripten and ubuntu, but your help gave me a lot of information. Currently, I am testing how to load java from node.js. (Link: https://www.geeksforgeeks.org/how-to-run-java-code-in-node-js/ ) If I succeed, I'll post another brief comment! |
It seems probably I am having a similar use case. @jyh7a , please, could you possibly share if you found any way to link the |
How can I link a .so file that is a shared library?
Hello.
I want to convert tester.c to tester.js file.
I need to link libMagicCrypto.so shared library to tester.c.
I entered the following command.
$ emcc tester.c -lMagicCrypto -L/home/jyh7a/webassembly -I/home/jyh7a/webassembly -ldl -o tester.js
But wasm-ld throws an unknown file type error and
emcc error also occurs. (It is attached below.)
2-1.
wasm-ld: error: unknown file type: /home/jyh7a/webassembly/libMagicCrypto.so
2-2.
5-1. Is it possible to dynamically link a shared library called .so ?
5-2. I wonder what is the cause of that error and how to fix it.
5-3. Please let me know if you need more information to solve the problem.
Thank you for your interest.
The text was updated successfully, but these errors were encountered: