-
Notifications
You must be signed in to change notification settings - Fork 15
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
Linker error (Mac with M3 processor) #58
Comments
Not certain, but I think following the advice from https://mac.r-project.org/bin/ will install the appropriate source("https://mac.R-project.org/bin/install.R")
install.libs("openssl") |
Hi Pete, Thanks, this seems to have worked. Great solution! I wonder if the libraries that |
Thanks for the reports. I'm surprised this hasn't come up before, but maybe there aren't too many people writing packages that link to Rhdf5lib, and the few that do have fortunately had the appropriate libraries in the search path by happenstance. My first instinct is to say that you just don't need the I vaguely recall trying to force this static linking a few years ago, but don't think it went well. That was also before we had an arm64 builder, where I'm sure the setup is different anyway. Maybe @jwokaty or @hpages have some thoughts on this? If not I can certainly document the need to have those extra libraries installed, but it will be a pain to point that out to all your users. The configure script is normally sufficient to detect whether those libraries are installed and set things appropriately for that system, but this doesn't work in the case where you installing a binary built on a system with more capabilities than the machine you're installing it on. |
Hi Mike, Thanks for the explanation. I have a few (probably very simple) questions. Note that I've read and am familiar with this document and the manual.)
At some point (once my understanding of the situation is better) I can try to come up with a set of instructions for installing |
@grimbough It's not clear to me why the output of My understanding is that this library is optional in order to install Rhdf5lib from source. If one doesn't have it, Rhdf5lib's
and it will keep going. You can actually see this on our Intel Mac builder lconway here (note that this is a temporary situation that will hopefully be remedied soon). Then, the output of
Now, if one does have the openssl library, then Rhdf5lib's
as you can see our arm64 Mac builder kjohnson1here. And in this case the output of
So what's puzzling me is that @timothy-barry had Could it be that you already had openssl installed via Homebrew on your machine @timothy-barry? Unfortunately, Homebrew installations tend to cause all sorts of problems for R and R packages. H. |
|
Great that you've read the documentation, I'm glad it's useful to someone! Happy to answer questions.
Yes, but there's not actually that many packages that do link against Rhdf5lib. If you look at the landing page there's 14. However 2 of those are mine, and several of the others are also have the same maintainers, so the pool of people who are developing packages that link against Rhdf5lib AND are using arm64 Macs for the development work AND don't have openssl in the search path is probably very small. Possibly you're the first!? I try to use GitHub actions and the Bioconductor Build System to test my packages on Mac OSX, but there's no arm64 GHA runners yet and the BBS has the openssl libraries available, so I've never triggered this issue with my own packages.
At the moment this would take some wrangling on your part. I'd suggest using something like
As @PeteHaitch says, try adding the BiocManager::install("Rhdf5lib", type = "source")
|
Hi @hpages
Yes, @timothy-barry said "I downloaded and installed the Rhdf5lib macOS Binary for arm64", so I think it's exactly that. It must be quite a rare situation for someone to install the binary Rhdf5lib, not have those libraries available themselves, and then build another package from source that links against it. Most users would either install everything from source so it's system specific compilation as you explained, or everything binary and then they never hit the linking error because there's no compiling done. Those in the second case might suffer if they actually try to use one of the functions that uses openssl, but I don't get the impression the S3 reading is widely used and that's the only place it's needed. I think if the builder only provided static libraries for Rhdf5lib to link against, then the appropriate code would be included in the binary. However I vaguely remember trying to do this several years ago, and it seems clear it was not successful since we're still in this situation. Perhaps we should try again? |
Well, actually, now that you mention it, the Mac builders are supposed to only provide static libraries. And, as a matter of fact, all the binaries provided by Simon Urbanek at https://mac.r-project.org/bin/ only contain static libraries. For example:
A central idea to the business of building and distributing Mac binaries for CRAN and Bioconductor packages is that these binaries should work on a pristine Mac where those optional system libraries are not necessarily available. So I went on kjohnson1 and took a look at the linking situation for Rhdf5lib and rhdf5:
They're only linked to system libraries that are guaranteed to be on the user machine. In particular, they're not linked to But this brings other questions.
H. |
Thanks for the extra details @hpages Just to get this straight in my head, am I right in thinking that kjohnson1 had both the static openssl from Simon Urbanek and the dynlib hombrew version installed? If that's the case, could the reason that I get the following if I use -> % nm -l rhdf5/libs/rhdf5.so | grep EVP
U EVP_sha256@OPENSSL_3.0.0 There the function Unfortunately I don't have the tools at hand to test the same for the |
Yep. Also note that the homebrew version provides both, static and dynlib libraries, as mentioned previously. However yesterday @jwokaty removed the homebrew version (see Bioconductor/BBS#378). Thanks Jen! So we'll see how things go on the next report for kjohnson1 (it should get updated later today).
As you can see above, the linking command for rhdf5 contains no path to
Bingo!
On kjohnson1:
¯\_(ツ)_/¯
Yes, I get that on Linux too. But since the linking command on Linux also contains
Linux tools won't recognize binaries created on Mac. Is there a way you could have access to a Mac? I'm not sure it's really feasible to troubleshoot all this stuff and come up with a clean linking command for Rhdf5lib + rhdf5 that does the right thing on Linux and Mac without actually having access to both platforms. There's just too much going on. |
TLDR: |
Hello,
Thanks for this helpful package. I've found it very useful over the past couple years.
I recently got a Mac with an M3 processor (previously, I was using a Mac with an i5 processor). I am having some difficulty compiling my package (
ondisc
), which depends on and links toRhdf5lib
.Some background: I downloaded and installed R-4.3.2-arm64.pkg (i.e., the version of R compatible with Mac M processors). Next, I downloaded and installed the
Rhdf5lib
macOS Binary for arm64 (the architecture used by Mac M processors) from here. I am able to call the functions contained withinRhdf5lib
without issue. For example, callingRhdf5lib::getHdf5Version()
returns"1.10.7"
, and callingRhdf5lib::pkgconfig()
returnsThe directory
/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/
indeed exists and containslibhdf5_cpp.a
, which seems to be a good starting point.However, when I try to install my package ondisc --- which depends upon and links to
Rhdf5lib
--- I get the following error.It looks like the linker is attempting to link against
libcrpyto
(which is part of the openSSL toolkit). My installation oflibcrpyto
does not appear to be on the search path, causing the error.As a final piece of information, when I downloaded and installed R-4.3.2-x86_64.pkg (i.e., the version of R compatible with Intel Macs), I was able to install
ondisc
without issue. I was happy to see this. However, I would strongly prefer not to use the Intel processor version of R, as the intel processor version of R is much slower than the M processor version of R for another package that I maintain.Any help would be greatly appreciated. Might a solution be to bundle the other C++ libraries (including
libcrpyto
) inside theRhdf5lib
package to avert this sort of problem?The text was updated successfully, but these errors were encountered: