You are here

compiler option not found

8 posts / 0 new
Last post
compiler option not found

Hi all,

I recently had to update my OSX command line tools and in doing so went from clang 12.0 to 13.0

I'm trying to compile Rosetta build 2021.16.61629 and am running into an issue. I was previously able to compile fine with clang v12.0.

As far as I can tell there seems to be an issue with the -rpath option, but that doesn't make much  sense. See the fail point and error messages below.

Not sure if this is a zlib issue given the fail point. As far as I can tell I have zlib installed properly. 


clang++ -v -o build/external/release/macos/12.0/64/x86/clang/13.0/default/libzlib.dylib -dynamiclib -install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.0/64/x86/clang/13.0/default/libzlib.dylib -stdlib=libc++ -Wl,-rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.0/64/x86/clang/13.0/default -Wl,-rpath=\$ORIGIN -Wl,-rpath=\$ORIGIN/../lib build/external/release/macos/12.0/64/x86/clang/13.0/default/dummy_zlib.os -Lexternal/lib -Lbuild/external/release/macos/12.0/64/x86/clang/13.0/default -Lexternal -L/usr/lib

Apple clang version 13.0.0 (clang-1300.0.29.3)

Target: x86_64-apple-darwin21.1.0

Thread model: posix

InstalledDir: /Applications/

"/Applications/" -demangle -lto_library /Applications/ -dynamic -dylib -arch x86_64 -dylib_install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.0/64/x86/clang/13.0/default/libzlib.dylib -platform_version macos 12.0.0 12.0 -syslibroot /Applications/ -o build/external/release/macos/12.0/64/x86/clang/13.0/default/libzlib.dylib -Lexternal/lib -Lbuild/external/release/macos/12.0/64/x86/clang/13.0/default -Lexternal -L/usr/lib -L/usr/local/lib -rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.0/64/x86/clang/13.0/default "-rpath=\$ORIGIN" "-rpath=\$ORIGIN/../lib" build/external/release/macos/12.0/64/x86/clang/13.0/default/dummy_zlib.os -lc++ -lSystem /Applications/

ld: unknown option: -rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.0/64/x86/clang/13.0/default

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Post Situation: 
Wed, 2021-12-08 10:28

(not an answer, but so you don't feel ignored): We've been kicking this around on Slack and nobody knows.  A few reports of "uh, I think I saw that once, I don't remember how I fixed it, then it went away".

Fri, 2021-12-10 08:57

Thanks for checking in Steven. 

I've done a fair amount of googling and it seems like there are lots of examples of weird clang linker errors.


Best I can understand is that there are some enviromental variables that are not being set/read right by the build system and it's trying to pass info that just doesn't work for the build system that is being used.

Fri, 2021-12-10 11:52

Made some progress  but would love some suggestions on a fix.

Based on some info I found here:

it sounds  like

Is not a valid input for mac's ld linker. I made the change on the command line to 

"-rpath" "/blah/blah/blah"

And it worked!

So that's good, but the problem is I don't know how to solve this at source. My guess is that something about the newer OSX/CommandLineTools  is not recognized by the compiler settings for my version of Rosetta (2021.16.61629).

Is there a new commercial release planned, or can someone point me to the right settings file I need to change to make sure everything is properly recognized?

Wed, 2021-12-15 06:26


Your guess is right.  Apple Clang is not recognized "-rpath" before Big Sur version. So, we just remove or annotate this part.

In details:

First, look for "Sconscript.src" and "Sconscript.apps" in the "/source/src" paths and open them. At about line 110, there will be:

env["RPATH"] = [

build.toplevel .... # annotate it

env.Literal(....) # annotate it

env.Literal(......) # annotate it


and then, cd to "/source/external"  open "Sconscript.external" line 91 to 93 annotate it.

save all and remove "/source/build" and /bin. recompile Rosetta 

Mon, 2022-04-18 08:01

Any updates to this? Running into the same issue.

Sun, 2022-01-23 19:25

Potential Solution but failed: I attempted to use an alternative version of clang to compile with. However, I still ran into the exact same error with clang v9 and clang v11. These are the steps I took below and received the exact same error as the initial post but with the alternative compiler being called.

My info:

MacOS: 12.1 (Monterey)

Default Clang with "xcode-select --install": 13.0

Rosetta Version: rosetta_src_2021.16.61629

Step 1:

brew install llvm@11

Step 2:

# Modify user.settings

cd rosetta_xx/main/source

cp /tools/build/user.settings.template /tools/build/user.settings

vim tools/build/user.settings

# Point to legacy clang under overrides

        "overrides" : {

            ## Uncomment the following line to import the full operating system environment.  Useful for

            ## compiling with scons on different systems.

            #"ENV" : os.environ,

                "cxx" : "/usr/local/opt/llvm@11/bin/clang++",

                "cc" : "/usr/local/opt/llvm@11/bin/clang",


Step 3:

# Build without using cxx= or cxx_ver= | Here's mine but with mpi as extras

./ bin mode=release extras=mpi -j8


Mon, 2022-01-24 11:16

Bit more followup here.

I'm still unable to complete the compile, but have somewhat tracked down the issue.

The default built compile command gives me an error:

clang++ -v -o build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -dynamiclib -install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -stdlib=libc++ -Wl,-rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default -Wl,-rpath=\$ORIGIN -Wl,-rpath=\$ORIGIN/../lib build/external/release/macos/12.2/64/x86/clang/13.0/default/dummy_zlib.os -Lexternal/lib -Lbuild/external/release/macos/12.2/64/x86/clang/13.0/default -Lexternal -L/usr/lib

Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.3.0
Thread model: posix

InstalledDir: /Applications/
 "/Applications/" -demangle -lto_library /Applications/ -dynamic -dylib -arch x86_64 -dylib_install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -platform_version macos 12.0.0 12.1 -syslibroot /Applications/ -o build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -Lexternal/lib -Lbuild/external/release/macos/12.2/64/x86/clang/13.0/default -Lexternal -L/usr/lib -L/usr/local/lib -rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default "-rpath=\$ORIGIN" "-rpath=\$ORIGIN/../lib" build/external/release/macos/12.2/64/x86/clang/13.0/default/dummy_zlib.os -lc++ -lSystem /Applications/
ld: unknown option: -rpath=/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default


However a bit of adjustment of the command line to change from -rpath=/blah/blah/blah to "-rpath" "/blah/blah/blah" seems to work. I also have to get rid of the $ORIGIN containing sections:

This then at least "works" but scons doesn't recognize it and won't let me complete a comiple.

clang++ -v -o build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -dynamiclib -install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -stdlib=libc++ -Wl,-rpath "/Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default"  -Lexternal/lib -Lbuild/external/release/macos/12.2/64/x86/clang/13.0/default -Lexternal -L/usr/lib

Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.3.0
Thread model: posix

InstalledDir: /Applications/
 "/Applications/" -demangle -lto_library /Applications/ -dynamic -dylib -arch x86_64 -dylib_install_name /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -platform_version macos 12.0.0 12.1 -syslibroot /Applications/ -o build/external/release/macos/12.2/64/x86/clang/13.0/default/libzlib.dylib -Lexternal/lib -Lbuild/external/release/macos/12.2/64/x86/clang/13.0/default -Lexternal -L/usr/lib -L/usr/local/lib -rpath /Users/benstranges/PROJECTS/rosetta_src_2021.16.61629_bundle/main/source/build/external/release/macos/12.2/64/x86/clang/13.0/default -lc++ -lSystem /Applications/


Anyone have any ideas how to adjust my build settings to get this to work?

Wed, 2022-02-16 06:57