Coder Social home page Coder Social logo

CRAN release about x13binary HOT 35 CLOSED

christophsax avatar christophsax commented on July 4, 2024
CRAN release

from x13binary.

Comments (35)

jeroen avatar jeroen commented on July 4, 2024 2

We could also do it in install.libs.R like so: #77 although maybe Dirks' solution is cleaner.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024 2

Winning so far thanks to @jeroen and #82 :

Dear maintainer,

package x13binary_1.1.60.tar.gz has been auto-processed and is pending an automated reverse dependency check. This service will typically respond to you within the next day. For technical reasons you may receive
+a second copy of this message when a team member triggers a new check.

Log dir: <https://win-builder.r-project.org/incoming_pretest/x13binary_1.1.60_20240122_155725/>
The files will be removed after roughly 7 days.
Installation time in seconds: 139
Check time in seconds: 52
R Under development (unstable) (2024-01-20 r85814 ucrt)

Pretests results:
Windows: <https://win-builder.r-project.org/incoming_pretest/x13binary_1.1.60_20240122_155725/Windows/00check.log>
Status: OK
Debian: <https://win-builder.r-project.org/incoming_pretest/x13binary_1.1.60_20240122_155725/Debian/00check.log>
Status: OK

Last released version's CRAN status: OK: 8, NOTE: 4
See: <https://CRAN.R-project.org/web/checks/check_results_x13binary.html>

CRAN Web: <https://cran.r-project.org/package=x13binary>

*** Strong rev. depends ***: gunsales seasonal x12

Best regards,
CRAN teams' auto-check service

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024 1

Also: Jeroen made some very recent improvements in mac builds and now has separate arm64 and x86_64 binaries. We could commit something simple to the main branch to trigger a new build. Maybe just increase the version to 1.1.59.2 as we will release as 1.1.60 anyway?

from x13binary.

Antonov548 avatar Antonov548 commented on July 4, 2024 1

I can try the helloworld idea during the weekend. Will see if there are other ideas until then.

I was trying hello world test before, when this issues appeared. Meantime I will try to find results.

from x13binary.

jeroen avatar jeroen commented on July 4, 2024 1

You don't have to set NeedsCompilation yourself; R automatically injects NeedsCompilation: yes in the DESCRIPTION when you build the source package. But because you don't have a source dir, it is setting NeedsCompilation: no. I think this may affect how the macbuilder treats it.

from x13binary.

jeroen avatar jeroen commented on July 4, 2024 1

Good catch. I tweaked the r-universe build setup a bit such that the libs at link time are in the standard location. I think this has fixed the problem. Actually no this hasn't fixed it.

When we build shared libraries in R packages, R takes care of relocating libfortran. But for a standalone executable it is probably different.

The R admin manual suggests you would need something like this:

install_name_tool -change
/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib \
/Library/Frameworks/R.framework/Resources/lib/libgfortran.5.dylib \
x13ashtml

install_name_tool -change
/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libquadmath.0.dylib \
/Library/Frameworks/R.framework/Resources/lib/libquadmath.0.dylib \
x13ashtml

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024 1

@christophsax Can you try running the build steps locally and then run the install_name_tool invocation, and/or try the install_name_tool invocation on the binary you get from r-universe?

from x13binary.

christophsax avatar christophsax commented on July 4, 2024 1

If I run @jeroen's lines on x13ashtml, it works perfectly:

install_name_tool -change /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib \
/Library/Frameworks/R.framework/Resources/lib/libgfortran.5.dylib \
x13ashtml

install_name_tool -change /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libquadmath.0.dylib \
/Library/Frameworks/R.framework/Resources/lib/libquadmath.0.dylib \
x13ashtml
x13binary::checkX13binary()
#> x13binary is working properly

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024 1

Either way works but the above could do with a generalization of finding the two dylib files.

from x13binary.

christophsax avatar christophsax commented on July 4, 2024 1

I installed the r-universe binaries on my M2 and on an older Intel Mac. Both work as advertised! 🎉

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024 1

Department of TaaDaa calling us on line one:

Dear maintainer,

thanks, package x13binary_1.1.60.tar.gz is on its way to CRAN.

Best regards,
CRAN teams' auto-check service

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

According to @Antonov548, mac builder does not work for some mysterious reason. It works, however, on GHA mac and on all (several) macs I tried so far, so I would suggest risking it and trying it on CRAN?

@eddelbuettel Please let me know if I can help with any of the tasks above.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

There are two mac architecture, and then of course different releases. That said, mac-builder is basically what CRAN uses for the newer arm64 so we need to build there.

r-universe now builds for both architectures. We could try another simple and see what happens.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

What is the supposed issue at macbuilder? Would it be possible to have everybody working on this actually chiming into the same issue? @Antonov548 can you share what worked or didn't?

For what it is worth, on the master branch as it is right now I built the source tar.gz the usual way, tested it with my r-devel built here (no issues) and submitted it to 'mac-builder' and all is good on arm64:

Given that we also have ✔️ on the CI platforms, it seems we are ready. Am I missing something here?

(Looks like Simon's webpage tricked me. I reported three times the same URL for the three tabs therein. Doh. Filed under 'today I learned ...'.)

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

Michael's older note, regarding issue on macbuilder (perhaps this is no longer the case?):

it's really strange, but executable which is created in macbuilder is not for mac actually.
I think it's related to how macbuilder builds the packages. I think it's not really mac host machines.

The executable is for Linux. I tried to run executable from macbuilder artifacts on linux and it works.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Can you please re-upload to macbuilder (if needed) or use the links I posted yesterday and validate that this is true? It strikes me as doubtful as I happen to know that the macbuilder is in fact an M1 box. Similarly Jeroen's work does not flake so we should know.

Shall we add (at least in CI) a test that invokes the new binary and, say, runs at least --version or equivalent?

from x13binary.

Antonov548 avatar Antonov548 commented on July 4, 2024

What is the supposed issue at macbuilder? Would it be possible to have everybody working on this actually chiming into the same issue? @Antonov548 can you share what worked or didn't?

For what it is worth, on the master branch as it is right now I built the source tar.gz the usual way, tested it with my r-devel built here (no issues) and submitted it to 'mac-builder' and all is good on arm64:

Given that we also have ✔️ on the CI platforms, it seems we are ready. Am I missing something here?

(Looks like Simon's webpage tricked me. I reported three times the same URL for the three tabs therein. Doh. Filed under 'today I learned ...'.)

I'm not very sure, but as far as I remember mac builder using aarch64 M1. And seems binary is not compatible with this platform. In the test there is check that platform is not aarch64: https://github.com/x13org/x13binary/blob/master/tests/simpleTest.R#L1

So, yes, it's compiling, but I think it doesn't work actually.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Hm.

One the one hand that is what the tests are supposed to uncover.

On the other that is a bit of puzzle as we are invoking fairly standard compilations with standard tools. So maybe this needs escalation to macOS specialists? Can you three take charge there as I understand that at least some of you have access to a M1 machine and possibly a subscription to the r-sig-mac mailing to discuss why/how Fortran would produce the wrong binary? Maybe we only lack a proper flag on that platform.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

So this made no change:

image

1.59.2 just like 1.59.1 just has 'any' for apple. Witness for example another package (by me, from my universe)

image

It has proper arm and x86 binaries. So maybe this happens to us because we have no src/ and maybe we should add a simple helloworld function that requires compilation? It's just a guess on my part. Any other ideas?

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

I can try the helloworld idea during the weekend. Will see if there are other ideas until then.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

I can also reach out to Jeroen. Maybe he has a moment. He spent a lot of time recently looking at build and port issues and may know what's up.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Reached out to @jeroen who may be taking a look. His immediate response points to one oversight: We left are getting NeedsCompilation: no in DESCRIPTION. Whoops.

from x13binary.

jeroen avatar jeroen commented on July 4, 2024

R is not very smart, it simply checks for the presence of a src dir if the package need compilation, and hence, if it is specific to the architecture: https://github.com/r-devel/r-svn/blob/8a3fc6542f6c24d2f4ea8d440653e58c032b182e/src/library/tools/R/build.R#L168-L173

And agian when building the binary package, it checks if there is a src dir, to identify if the package is portable or not: https://github.com/r-devel/r-svn/blob/8a3fc6542f6c24d2f4ea8d440653e58c032b182e/src/library/tools/R/admin.R#L73

So the easiest solution is simply creating a src dir with some dummy text file.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Some more offline chatting with @jeroen: The way we build now ignores R's own Makeconf so we likely do not do the right things on ports and crossbuilds. Easiest fix may be bring the build of the binary into src/Makevars as a build target which also copies into the desired place. That way we get right compiler invocations and options. I can take a stab, time permitting.

from x13binary.

jeroen avatar jeroen commented on July 4, 2024

There is also another bug that your makefile is generating an executable called x13as_html (with underscore) but your R code checkX13binary is looking for x13ashtml.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Two more additions, maybe:

  • Add Jeroen to AUTHORS
  • Add a test that the binary loads, maybe via capture.output checking the expected text (or parts of it) is there

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Looking much better now thanks to all the work done by everybody and especially @jeroen pushing us over the (macOS-coloured) finish line:

image

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

Amazing work, thank you so much @jeroen!

I still have a problem on my Mac: When I install from r-universe:

install.packages('x13binary', repos = c('https://x13org.r-universe.dev', 'https://cloud.r-project.org'))

It does not find some libraries:

x13binary::checkX13binary()
dyld[99255]: Library not loaded: /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib
  Referenced from: <4BD7F637-67CD-3F1E-ACFC-5779CF824785> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/x13binary/bin/x13ashtml
  Reason: tried: '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)

libgfortran.5.dylib can be found on my machine but it is in:

/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib

Any idea? I will play around with this later on.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Now we have to find a clever to 'find' / 'compute' the respective first part (in /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0) to set the second.

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

There is otool, perhaps something like this?

otool -L x13ashtml
x13ashtml:
	/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
	/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Nice one! My mental model was on find. We can run otool into grep to get the line and then use it as the first arg.

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

I guess something like this could work?

libgfortran_path=$(otool -L x13ashtml | grep libgfortran.5.dylib | awk '{print $1}')
libquadmath_path=$(otool -L x13ashtml | grep libquadmath.0.dylib | awk '{print $1}')

install_name_tool -change "$libgfortran_path" \
/Library/Frameworks/R.framework/Resources/lib/libgfortran.5.dylib \
x13ashtml

install_name_tool -change "$libquadmath_path" \
/Library/Frameworks/R.framework/Resources/lib/libquadmath.0.dylib \
x13ashtml

In which file should we put it? And I guess we also need to make sure this only happens on macs.

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

Very good. Wait one sec and I'll have something related, using a 'conditional' I use elsewhere.

Please replace src/Makefile with this:

all:
	FC="$(FC)" LINKER="$(DYLIB_LD)" LDFLAGS="$(FLIBS)" $(MAKE) --directory=../tools/x13as_html -f makefile.gf x13ashtml
	if [ `uname -s` = 'Darwin' ]; then
		install_name_tool -change `otool -L x13ashtml | awk '/libgfortran.5.dylib/ '{print $1}'` /Library/Frameworks/R.framework/Resources/lib/libgfortran.5.dylib ../tools/x13as_html/x13ashtml
		install_name_tool -change `otool -L x13ashtml | awk '/libquadmath.0.dylib/ '{print $1}'` /Library/Frameworks/R.framework/Resources/lib/libquadmath.0.dylib ../tools/x13as_html/x13ashtml
	fi
	mkdir -p ../inst/bin
	cp -f ../tools/x13as_html/x13ashtml ../inst/bin/

clean:
	rm -f ../tools/x13as_html/x13ashtml

which adds the two new (and long, no indentation) lines wrapped by an 'if' for macOS so in diff notation:

modified   src/Makefile
@@ -1,5 +1,9 @@
 all:
 	FC="$(FC)" LINKER="$(DYLIB_LD)" LDFLAGS="$(FLIBS)" $(MAKE) --directory=../tools/x13as_html -f makefile.gf x13ashtml
+	if [ `uname -s` = 'Darwin' ]; then
+		install_name_tool -change `otool -L x13ashtml | awk '/libgfortran.5.dylib/ '{print $1}'` /Library/Frameworks/R.framework/Resources/lib/libgfortran.5.dylib ../tools/x13as_html/x13ashtml
+		install_name_tool -change `otool -L x13ashtml | awk '/libquadmath.0.dylib/ '{print $1}'` /Library/Frameworks/R.framework/Resources/lib/libquadmath.0.dylib ../tools/x13as_html/x13ashtml
+	fi
 	mkdir -p ../inst/bin
 	cp -f ../tools/x13as_html/x13ashtml ../inst/bin/

from x13binary.

eddelbuettel avatar eddelbuettel commented on July 4, 2024

I think we are ready. Finalizing a release branch for review.

from x13binary.

christophsax avatar christophsax commented on July 4, 2024

Amazing, thank you so much!

from x13binary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.