Skip to content

Linker error (Mac with M3 processor) #58

@timothy-barry

Description

@timothy-barry

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 to Rhdf5lib.

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 within Rhdf5lib without issue. For example, calling Rhdf5lib::getHdf5Version() returns "1.10.7", and calling Rhdf5lib::pkgconfig() returns

"/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/libhdf5_cpp.a" "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/libhdf5.a" -L"/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib" -lcrypto -lcurl -lsz -laec -lz -ldl -lm 

The directory /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/ indeed exists and contains libhdf5_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.

clang++ -arch arm64 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o ondisc.so RcppExports.o h5_import_data_functs.o h5_initialize_functs.o h5_load_row.o h5_simple_read.o shared_functs.o utility_functs.o /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/libhdf5_cpp.a /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib/libhdf5.a -L/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/Rhdf5lib/lib -lcrypto -lcurl -lsz -laec -lz -ldl -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

ld: library 'crypto' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like the linker is attempting to link against libcrpyto (which is part of the openSSL toolkit). My installation of libcrpyto 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 the Rhdf5lib package to avert this sort of problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions