Page 1 of 1

Installing package fields

Posted: Tue Sep 24, 2024 11:32 pm
by dadedodo
Dear all,

I am trying to create a module that has some functions from the package fields (Jamovi 2.5.6). However, I got an error saying that I need gfortran to install the 'fields' package (attached the error code). Is there a solution to solve this issue? Thanks!

* installing *source* package ‘fields’ ...
** package ‘fields’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
sh: /opt/gfortran/bin/gfortran: No such file or directory
using SDK: ‘MacOSX14.4.sdk’
clang -arch x86_64 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c ExponentialUpperC.c -o ExponentialUpperC.o
clang -arch x86_64 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c RdistEarth.c -o RdistEarth.o
clang -arch x86_64 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c addToDiagC.c -o addToDiagC.o
clang -arch x86_64 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c compactToMatC.c -o compactToMatC.o
clang -arch x86_64 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c expfnC.c -o expfnC.o
/opt/gfortran/bin/gfortran -arch x86_64 -fPIC -Wall -g -O2 -c fieldsF77Code.f -o fieldsF77Code.o
make: /opt/gfortran/bin/gfortran: No such file or directory
make: *** [fieldsF77Code.o] Error 1

Re: Installing package fields

Posted: Wed Sep 25, 2024 12:19 am
by jonathon
hi,

this is an R issue, rather than a jamovi one ... you *could* try installing the appropriate fortran compiler, etc. etc. but this can often turn into a rabbit hole ... building native R packages under macOS isn't for the faint of heart.

what R package are you trying to use? i assume this is an R package you're adding to your module's DESCRIPTION file.

i may be able to manually add a built version of the package to our repo, so as to bypass this built step.

jonathon

Re: Installing package fields

Posted: Wed Sep 25, 2024 11:34 am
by dadedodo
Thanks for the quick replay. You are right, I am calling the installation from the DESCRITPTION file.

Re: Installing package fields

Posted: Wed Sep 25, 2024 11:53 am
by jonathon
try that. i've added the fields binaries to the jamovi repo, and when you run `jmvtools::install()` now, it should pull the built binaries down, rather than the source versions.

jonathon

Re: Installing package fields

Posted: Thu Sep 26, 2024 10:57 pm
by dadedodo
Hi Jonathon, I am still having some issues in getting fields installed. I have installed gfortran that it is recognize by R, but I got an error saying that my gfortran is for amr and the package requires intel. It seems that `jmvtools::install()` is still trying to use the source version. I am using jamovi 2.5.6. Thanks a lot for your support.

Re: Installing package fields

Posted: Thu Sep 26, 2024 11:11 pm
by jonathon
ah, that could be your issue. upgrade to 2.6 ...

jonathon

Re: Installing package fields

Posted: Fri Sep 27, 2024 9:43 am
by dadedodo
I am working on a project in which I have attendees using my module on Mac and Windows. I found that building a module on 2.5.6 in Mac or Windows works on both. Would this be the same with 2.6? Should I use the solid version of Jamovi whic has a longer life span?

Re: Installing package fields

Posted: Fri Sep 27, 2024 10:42 am
by jonathon
> I found that building a module on 2.5.6 in Mac or Windows works on both.

it depends. if your have all non-native R packages, then it can sometimes work across platforms. in your case, you're using the `fields` package, and that has native code (which is why it wants a fortran compiler) ... so i wouldn't expect it to work across platform, and rather, you would need to build 5 different versions (eventually 6) ... one for macOS x64, one for macOS arm64, one for linux on x64, one for linux on arm64, and one for windows on x64 (and eventually, one for windows on arm64) ...

this is where we do some of the heavy lifting ... because if its in the jamovi library, we automatically build it for all the platforms.

i would target the 2.6 ... it will become the "solid" fairly soon.

jonathon