Skip to content

build failed (link error) because C object file (stdlib_system_subprocess.c.o) is architecture x86_64 and not arm64 #1020

@sto3014

Description

@sto3014

Description

  • in shell change to stdlib repository
  • cmake -B build -G Ninja
  • cmake --build build

error:
Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive member: src/libfortran_stdlib.a(stdlib_system_subprocess.c.o) cputype (16777223) does not match previous archive members cputype (16777228) (all members must match).

with -DCMAKE_VERBOSE_MAKEFILE=on one can see that the compile flag -arch is set to x86_64:

  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -DSTDLIB_EXTERNAL_BLAS -DSTDLIB_EXTERNAL_LAPACK -I"/Users/dieterstockhausen/Library/Mobile Documents/comappleCloudDocs/Projekte/ThirdParty/Fortran/stdlib/build/src/mod_files" -O2 -g -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk -fPIC -MD -MT src/CMakeFiles/fortran_stdlib.dir/stdlib_system_subprocess.c.o -MF src/CMakeFiles/fortran_stdlib.dir/stdlib_system_subprocess.c.o.d -o src/CMakeFiles/fortran_stdlib.dir/stdlib_system_subprocess.c.o -c '/Users/dieterstockhausen/Library/Mobile Documents/comappleCloudDocs/Projekte/ThirdParty/Fortran/stdlib/src/stdlib_system_subprocess.c'

If I take this command and change -arch to arm64 and compile stdlib_system_subprocess.c the linker is able to link libfortran_stdlib.a (I used the link command from the previous CMAKE logging).

This issue does not occur on Ubuntu 24.04.2 LTS (arm64).

Expected Behaviour

Do we need a fix, or is there a workaround for setting the architecture to arm64?

Version of stdlib

latest

Platform and Architecture

MacOS/ARM

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions