Skip to content

arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles #3826

Closed

Description

@AlexanderVasiljev

I have faced the same issue as #3209.

I have just installed Ubuntu 21.04. The first build on new Ubuntu failed with this error.

LOG

LD: nuttx
arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)
make[1]: *** [Makefile:156: nuttx] Error 1

GCC version

arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:9-2019-q4-0ubuntu2) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]

Ld version

arm-none-eabi-ld --version
GNU ld (2.36.1-0ubuntu1+14build1) 2.36.1

Activity

  1. Ouss4 commented on Jun 2, 2021

    @Ouss4
    Member

    Oh this issue is now on Debian based distros as well?

    We've seen this (a general did you mean --option instead of -option) in arch based distros. We couldn't see any references in the GNU project where -option is replaced with --option, so we assumed an issue in the Arch package.

    Anyway, did you try to download the toolchain as described in #3209?

  2. AlexanderVasiljev commented on Jun 2, 2021

    @AlexanderVasiljev
    ContributorAuthor

    See my question on binutils
    https://sourceware.org/pipermail/binutils/2021-June/116825.html

    The answer https://sourceware.org/pipermail/binutils/2021-June/116826.html
    from [email protected] is

    The -nostartfiles option is a gcc command line option, not a linker
    command line option. It is used when gcc is creating an executable
    binary and it tells gcc not to include the standard system files
    (eg crt1.o, crtbegin.o, crtend.o etc) when gcc invokes the linker.

    All of which means that in your build system somewhere you have:

    arm-none-eabi-ld -nostartfiles ...

    whereas you probably meant to have:

    arm-none-eabi-gcc -nostartfiles ...

    Note: the reason why this problem has appeared when you upgraded is
    that we recently added some extra error checking to the linker to
    attempt to detect mis-spelt command line options.
    In particular the
    linker interprets options that start with a single dash as if they
    were multiple, single letter options. So "-nostartfiles" would be
    treated as "-n" "-o startfiles" which is probably not what the user
    wanted. Hence the error message.

    Plus, just to be clear, the linker does not support a --nostartfiles
    option. The code that generates the error message does not actually
    check to see if the double dash version of the option exists...

  3. AlexanderVasiljev commented on Jun 2, 2021

    @AlexanderVasiljev
    ContributorAuthor

    The flag nostartfiles is not a flag of ld. So it shouldn't appear in LDFLAGS += -nostartfiles

    I assume that we should change
    LDFLAGS += -nostartfiles -nodefaultlibs
    to
    CXXFLAGS += -nostartfiles -nodefaultlibs
    in every board Make.defs

    It works for my board

  4. AlexanderVasiljev commented on Jun 3, 2021

    @AlexanderVasiljev
    ContributorAuthor
  5. hartmannathan commented on Jun 10, 2021

    @hartmannathan
    Contributor

    This is caused by Binutils being updated to the 2.36.x line.

    This is fixed by PR #3836

    This is now documented at Release Notes for the (future) NuttX-10.2 release:

    https://cwiki.apache.org/confluence/display/NUTTX/NuttX+10.2#ld-now-called-through-gcc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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