Skip to content
This repository was archived by the owner on Jan 16, 2023. It is now read-only.

Build failure OS X: illegal options for BSD ar #353

@ppannuto

Description

@ppannuto

Trying to build on OS X fails around make: *** [libfesvr.a] Error 1. Digging into this a bit, it is because the build relies on GNU-only ar options:

[-bash] Fri 18 Feb 10:59 [[master] ~/code/external/riscv-tools]
$ cd riscv-isa-sim/build/
/Users/ppannuto/code/external/riscv-tools/riscv-isa-sim/build

[-bash] Fri 18 Feb 10:59 [[(v1.0.0)] ~/code/external/riscv-tools/riscv-isa-sim/build]
$ ar rcs -o libfesvr.a elfloader.o htif.o memif.o dtm.o syscall.o device.o rfb.o context.o htif_pthread.o htif_hexwriter.o dummy.o option_parser.o term.o tsi.o
ar: illegal option combination for -r
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
	ar -m [-abiTLsv] position archive file ...
	ar -p [-TLsv] archive [file ...]
	ar -q [-cTLsv] archive file ...
	ar -r [-cuTLsv] archive file ...
	ar -r [-abciuTLsv] position archive file ...
	ar -t [-TLsv] archive [file ...]
	ar -x [-ouTLsv] archive [file ...]

[-bash] Fri 18 Feb 10:59 [[(v1.0.0)] ~/code/external/riscv-tools/riscv-isa-sim/build]
$ which ar
/usr/bin/ar

[-bash] Fri 18 Feb 10:59 [[(v1.0.0)] ~/code/external/riscv-tools/riscv-isa-sim/build]
$ /usr/local/opt/binutils/bin/ar rcs -o libfesvr.a elfloader.o htif.o memif.o dtm.o syscall.o device.o rfb.o context.o htif_pthread.o htif_hexwriter.o dummy.o option_parser.o term.o tsi.o

Where /usr/bin/ar, the default ar is the version installed natively on Mac, while:

$ /usr/local/opt/binutils/bin/ar --version
GNU ar (GNU Binutils) 2.37
Copyright (C) 2021 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

is the GNU version installed via brew install binutils.

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