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

Added recipe for fftw3 #317

Merged
merged 1 commit into from
Nov 14, 2023
Merged

Added recipe for fftw3 #317

merged 1 commit into from
Nov 14, 2023

Conversation

dipterix
Copy link
Contributor

@dipterix dipterix commented Nov 12, 2023

Trying to resolve r-universe-org/help#321

@dipterix dipterix marked this pull request as ready for review November 13, 2023 02:35
@dipterix
Copy link
Contributor Author

@georgestagg

Copy link
Member

@georgestagg georgestagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to me like a good recipe for FFTW3, thank you!

I'm happy to merge, but be aware that from my limited testing so far, it looks like the ravetools package still won't be able to build under Wasm yet even, with the FFTW3 library available for Wasm. There is still lots of work to be done on our side for this to work really well.

Two of the things that do not currently work well under wasm are handling R packages that use configure scripts (a specific test for cross-compiling fails) and handling R packages that use threads. Unfortunately, that package uses both.

@dipterix
Copy link
Contributor Author

With a little bit more digging into the build, I found that pkg-config has been installed. This makes me wonder if we could use the existing pkg-config to find flags from fftw3.pc because it is used by many configure.ac.

Currently pkg-config environment variable PKG_CONFIG_PATH is improperly set. I wonder if this is intentional? I have to manually set (hard-code the pkg-config path to /opt/webr/wasm/lib/pkgconfig

export PKG_CONFIG_PATH=/opt/webr/wasm/lib/pkgconfig

Any advice? : )

@georgestagg
Copy link
Member

The PKG_CONFIG_PATH variable is set up by the Wasm build tools, you should not need to set it yourself.

I have been able to compile your package (ravetools commit c3fb625) after all on my test machine with this PR applied[1]. pkg-config was indeed able to find the wasm FFTW3 build.

So, I will merge the change. After a few hours, once CI has finished, a new webR Docker image will be uploaded, and once that has filtered through to r-universe I expect that your package will be able to build.

Local log output:

* installing *source* package ‘ravetools’ ...
** using non-staged installation
R_HOME found: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources
configure: Running under OSX... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for FFTW... yes
configure: creating ./config.status
config.status: creating src/Makevars

================================
compiler flags: -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include
link argument:  -L/Users/georgestagg/work/webr/wasm/lib -lfftw3 
================================

** libs
using C++ compiler: ‘emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.37 (d02c29f95e9e68f2f50c2b0432c56a671814d5c8)’
using C++17
using SDK: ‘MacOSX14.0.sdk’
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c RcppExports.cpp -o RcppExports.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c baseline.cpp -o baseline.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c bucketFill.cpp -o bucketFill.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c collapse-cplx.cpp -o collapse-cplx.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c collapse-real.cpp -o collapse-real.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c columnQuantile.cpp -o columnQuantile.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c fastColMeans.cpp -o fastColMeans.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c fastQuantile.cpp -o fastQuantile.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c fastcov.cpp -o fastcov.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c ffts.cpp -o ffts.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c fftw-wrapper.cpp -o fftw-wrapper.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c filter.cpp -o filter.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c glMatrix4.cpp -o glMatrix4.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c glQuaternion.cpp -o glQuaternion.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c glVector3.cpp -o glVector3.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c rawToSEXP.cpp -o rawToSEXP.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c shiftarray.cpp -o shiftarray.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c threads.cpp -o threads.o
em++ -std=gnu++17 -DNDEBUG -I/Users/georgestagg/work/webr/wasm/include  -I../inst/include -I'/Users/georgestagg/Library/R/arm64/4.3/library/Rcpp/include'  -I/Users/georgestagg/work/webr/wasm/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/build/include -I/Users/georgestagg/work/webr/R/build/R-4.3.0/src/include -s USE_BZIP2=1 -s USE_ZLIB=1  -fPIC  -std=gnu++17   -Oz -fPIC -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -DRCPP_DEMANGLER_ENABLED=0 -D__STRICT_ANSI__ -c utils.cpp -o utils.o
em++ -std=gnu++17 -s SIDE_MODULE=1 -s WASM_BIGINT -s ASSERTIONS=1 -L/Users/georgestagg/work/webr/wasm/lib -L/Users/georgestagg/work/webr/wasm/R-4.3.0/lib/R/lib -s USE_BZIP2=1 -s USE_ZLIB=1 -fwasm-exceptions -s SUPPORT_LONGJMP=wasm -Oz -o ravetools.so RcppExports.o baseline.o bucketFill.o collapse-cplx.o collapse-real.o columnQuantile.o fastColMeans.o fastQuantile.o fastcov.o ffts.o fftw-wrapper.o filter.o glMatrix4.o glQuaternion.o glVector3.o rawToSEXP.o shiftarray.o threads.o utils.o -L/Users/georgestagg/work/webr/wasm/lib -lfftw3
installing to /private/var/folders/wx/qv_075m16yx5lqwvjfwswfqm0000gn/T/RtmptXmn3S/file64e6ff32f05/ravetools/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
* creating tarball
packaged installation of ‘ravetools’ as ‘ravetools_0.1.2.9006_R_aarch64-apple-darwin20.tar.gz’
* DONE (ravetools)

@georgestagg georgestagg merged commit 74f8298 into r-wasm:main Nov 14, 2023
2 checks passed
@jeroen
Copy link
Contributor

jeroen commented Nov 16, 2023

The ravetools wasm binaries are now available for public: https://rave-ieeg.r-universe.dev/ravetools

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

Successfully merging this pull request may close these issues.

pkg-config cannot find fftw3 in WASM
3 participants