[riscv-sw] Any idea about "unrecognized option --64" from g++ during riscv toolchain build?

2,421 views
Skip to first unread message

Rishiyur Nikhil

unread,
Jan 15, 2016, 5:59:31 PM1/15/16
to sw-...@lists.riscv.org
Sorry if this is noise on the list, but I searched intensively for a solution on the
Web and other channels, without success.

During a build of the RISC-V gnu tool chain, I encounter the following
failure, where the newly-built riscv assembler complains about an
unrecognized option '--64' while compiling genmddeps.c:

    $ g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions \
    -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings \
    -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic \
    -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings \
    -DHAVE_CONFIG_H -DGENERATOR_FILE \
    -I. -Ibuild -I$(BUILD_DIR)/riscv-gnu-toolchain/src/newlib-gcc/gcc \
    -I$(BUILD_DIR)/riscv-gnu-toolchain/src/newlib-gcc/gcc/build \
    -I$(BUILD_DIR)/riscv-gnu-toolchain/src/newlib-gcc/gcc/../include \
    -I$(BUILD_DIR)/riscv-gnu-toolchain/src/newlib-gcc/gcc/../libcpp/include  \
    -o build/genmddeps.o \
    $(BUILD_DIR)/riscv-gnu-toolchain/src/newlib-gcc/gcc/genmddeps.c
    .../opt/riscv-im/riscv64-unknown-elf/bin/as: unrecognized option '--64'
    Makefile:2428: recipe for target 'build/genmddeps.o' failed

I'd appreciate any suggestions on how to fix this.

Here's some info about my platform (it's a rather new version of g++,
which may be the problem):

    $ uname -a
    Linux blacklab 4.2.0-22-generic #27-Ubuntu SMP Thu Dec 17 22:57:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

    $ g++ --version
    g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
    Copyright (C) 2015 Free Software Foundation, Inc.

    $ as --version
    GNU assembler (GNU Binutils for Ubuntu) 2.25.1
    Copyright (C) 2014 Free Software Foundation, Inc.
    This assembler was configured for a target of `x86_64-linux-gnu'.

Thanks,

Nikhil

Michael Clark

unread,
Jan 15, 2016, 6:03:37 PM1/15/16
to Rishiyur Nikhil, sw-...@lists.riscv.org
The option should be -m64

Rishiyur Nikhil

unread,
Jan 15, 2016, 6:09:17 PM1/15/16
to Michael Clark, sw-...@lists.riscv.org
Well the new standard 'as'

    GNU assembler (GNU Binutils for Ubuntu) 2.25.1
indeed now has the flags --32, --64, etc.

It seems that in this case, it's compiling with standard 'g++'

    g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
which might therefore pass --64 to the standard 'as',
but here it is invoking the newly-built RISC-V 'as' which does
not recognize the flag.

Nikhil

Michael Clark

unread,
Jan 15, 2016, 6:25:44 PM1/15/16
to Rishiyur Nikhil, sw-...@lists.riscv.org
Yes compiler options and assembler options between gcc and gas on x86 appear to be different.

I note that gcc compiler uses -m32 and -m64 options during compile however GNU as on x86 takes, as you mention, --32 and --64

$as --help
[snip
�� --32/--64/--x32���������������� generate 32bit/64bit/x32 code

however the present RISC-V GNU as currently takes -m32 and -m64 options

$ riscv64-unknown-elf-as --help
Usage: riscv64-unknown-elf-as [option...] [asmfile...]
Options:
[snip]
RISC-V options:
�� -m32�������������������� assemble RV32 code
�� -m64�������������������� assemble RV64 code (default)
�� -fpic������������������ generate position-independent code
 ��-fno-pic������������ don't generate position-independent code (default)
Report bugs to <http://www.sourceware.org/bugzilla/>

I was quick to respond as I was trying to figure this out just the other day and was aware of the options.

Why is the standard compiler invoking the RISC-V assembler? Surely the standard compiler doesn't know how to output RISC-V assembler...

Rishiyur Nikhil

unread,
Jan 15, 2016, 6:35:30 PM1/15/16
to Michael Clark, sw-...@lists.riscv.org
>    Why is the standard compiler invoking the RISC-V assembler?
>    Surely the standard compiler doesn't know how to output RISC-V assembler...

I don't know.   The command is invoked somewhere in the build mechanism, which I'm using
blindly.   I'll have to investigate to locate its origin.

Thanks,

Nikhil

Jack Koenig

unread,
Mar 15, 2016, 3:29:08 PM3/15/16
to Rishiyur Nikhil, Michael Clark, sw-...@lists.riscv.org
I don't know if you ever resolved this, but I recently ran into a similar problem. The issue was having '.' in my PATH. ie.
I had "export PATH=.:$PATH" in my .bashrc file. Clearly a bad idea, but I needed this for some EDA tool a while ago, can't remember the exact issue.

Hope this helps you or anyone else searching for the error.

Rishiyur Nikhil

unread,
Mar 15, 2016, 5:09:18 PM3/15/16
to Jack Koenig, Michael Clark, sw-...@lists.riscv.org
Hi Jack,

I had raised the original question in this thread.

We eventually figured out what was going on, and fixed it.

Briefly:
- Suppose you are making the tool chain in some target directory TARGET_DIR
- Then, before doing 'make' to create the tool chain,
    make sure $(TARGET_DIR)/bin is in your path.

- Otherwise, at some point during the build, when it wants to use g++,
    it defaults to using an existing g++ (instead of the new RISC-V
    g++ that it just built).

    This existing g++, if it is a recent version, will call the RISC-V
    assembler with the (relatively recent) flag '--64', which the RISC-V
    assembler does not recognize, etc.

Rgds,

Nikhil

Reply all
Reply to author
Forward
0 new messages