简体   繁体   中英

sourceCpp error: not mach-o or a static library file '/usr/local/lib/libgfortran.dylib'

I've long been a user of RcppArmadillo, but have been unable to compile any programs via sourceCpp since upgrading my OS to Monterey Version 12.3.

Getting the following error:

ld: malformed universal file: slice content is not mach-o or a static library file '/usr/local/lib/libgfortran.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_2.so] Error 1

It seems like this has something to do with static vs dynamic linking judging by the post here but I really have no idea.

I got the same ld error when I upgraded to Xcode 13.3. I've reverted to 13.2 and my projects build with no errors. I'll stay with 13.2 until I see more information coming out on what's causing this problem.

Reinstall RcppArmadillo

-> install.packages("RcppArmadillo", type = "source")

If something wrong, try to modify your makeconf file:

FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin21/11.2.0 #-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm

This is from the XCode 13.3 release notes. I guess the issue is related to this change.

The new chained fixups format is the default linking method when targeting macOS 11 or later, iOS 13.4 or later, watchOS 7.0 or later, and tvOS 14.0 or later. This new format results in smaller LINKEDIT segments in binaries. When targeting earlier operating system releases, the linker continues to generate the traditional opcode format in LINKEDIT for fixups, rebases, and binds. (85572905)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM