irmen / binaryen-interfaces

non-C programming language interfaces to the Binaryen library
11 stars 5 forks source link

Instructions on static installation #2

Closed dom96 closed 1 year ago

dom96 commented 2 years ago

Thank you for putting this library together!

I had to end up editing the setup file to run the -staticlib variant manually for the install. Is there a better way?

irmen commented 2 years ago

I've not looked at that at all so far. What did you change?

dom96 commented 2 years ago

Setup.py to point at the -staticlib variant in cffi_modules and an update to binaryen_extract_path in build_ffi_module-staticlib.py.

I'm not super familiar with how setup.py operates. But maybe best approach is to look for "./binaryen" and if it doesn't exist fail with a nice error that explains to put the binaryen source code inside ./binaryen? Downloading this automatically would also work but not sure how complex you wanna make it.

irmen commented 2 years ago

what's the reason you're not going with the default dynamic linked install?

dom96 commented 2 years ago

As best as I could tell it required binaryen to be in /usr/include and I couldn't find a package that installed it there.

irmen commented 2 years ago

I build binaryen directly from source and it places its header files there when installed like that. Where are yours located? Maybe it's a good idea to add an alternative search location for the header files?

dom96 commented 2 years ago

ahh, I didn't build binaryen directly. Does its build process automatically install the header files into /usr/include?

What I did is just downloaded a release tarball and searched for a way to use it with this package :)

irmen commented 2 years ago

Hmm, it used to ... older builds did... but the current one installs to /usr/local/include by default. I haven't looked much into binaryen's build process though, I guess you can configure the install location. I guess distro maintainers might change this default if they supply a binaryen package.

For the default build of the python wrapper, setup.py chooses the dynamically linked build and expects the include files either in /usr/local/include or in /usr/include .

I don't know of another way to select the statically linked build, other than indeed manuall change the reference to the other cffi gen script in setup.py.

dom96 commented 1 year ago

Just setup a CI for my project and ended up just downloading a Binaryen release, then symlinking the files manually into /usr/. Created a PR to add instructions on how to do that :)