question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cc1.exe: error: output filename specified twice

See original GitHub issue

i am using mbed os 5 for compilation, i am getting this error (cc1.exe: error: output filename specified twice) please some one help.

{
    "GCC_ARM": {
        "common": ["-c", "-Wall", "-Wextra",
                   "-Wno-unused-parameter", "-Wno-missing-field-initializers",
                   "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
                   "-ffunction-sections", "-fdata-sections", "-funsigned-char",
                   "-MMD", "-fno-delete-null-pointer-checks",
                   "-fomit-frame-pointer", "-O3", "-DNDEBUG", "-g1"],
        "asm": ["-x", "assembler-with-cpp"],
        "c": ["-std=gnu99"],
        "cxx": ["-std=gnu++98","-fno-rtti", "-Wvla"],
        "ld": ["-Wl,--gc-sections", "-Wl,--wrap,main", "mfpu=fpv4-sp-d16", "-Wl,--wrap,_malloc_r",
               "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r", "-Wl,--wrap,_memalign_r",
               "-Wl,--wrap,_calloc_r", "-Wl,--wrap,exit", "-Wl,--wrap,atexit",
               "-Wl,-n"]
    }
}

this is my release_O3.json

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
theotherjimmycommented, Nov 14, 2018

@vrushalibhokare I think we’re going about this in a way that is less helpful to both of us:

please give me solution of this above error.

Please don’t ask me to do your homework. Further, the error you’re seeing is expected and correct behavior. Finally, I don’t know what you’re trying to do (so far you have just said “fix it” with compiler erros). Without context, I can only help you so much.

I understand that asking a good question to help everyone involved is a skill that takes practice. I’m going to try guessing what questions you could ask that are more helpful to both of us. I don’t know how much you know (pro tip: include what you have tried and what information you know in the issue/question description)

Perhaps you meant to ask the question:

What can cause this error?

That’s a question that I can help you with. The linker is claiming that the object files contained within the archive, libPDMFilter_CM4_GCC.a, are compiled to use “VFP register arguments” (more on this in a bit) and that the executable you’re generating, kws_realtime_test.elf, does not use them. “VFP register arguments” is a C/C++ calling convention term made from:

  • “VFP” meaning “Vector Floating Point co-processor”.
  • “register arguments” are how C/C++ functions pass arguments/parameters to each other in the Arm EABI (Extended Application Binary Interface or machine code used to call functions) calling convention: through registers.

So “VFP register arguments” is referring to how to treat Floating point function call arguments. Specifically using “VFP register arguments” indicates that the VFP’s registers are used for float arguments. Your libPDMFilter_CM4_GCC.a(pdm_filter.o) library does this, but the rest of your program was compiled expecting floating point arguments to be passed in the CM4’s registers. These two calling conventions are incompatible, as the code that was generated in say main.o expected that it could call functions in pdm_filter.o and pass float arguments in the CM4’s registers. If this were to link without the error, then the output of this program would be completely arbitrary!

You might then follow up with:

That’s all well and good @theotherjimmy, but how do could I inspect what calling convention a given .o file is compiled for? How can I catch this sort of thing way before the link step?

That’s part of the arm-none-eabi-readelf output, as described in this stack overflow question: https://stackoverflow.com/questions/20555594/how-can-i-know-if-an-arm-library-is-using-hardfp

And after running that command on your main.o you might ask:

Why is main.cpp compiled to use CM4 registers for floating point arguments?

Looking in the tools that build your binary (specifically here: https://github.com/ARMmbed/mbed-os/blob/master/tools/toolchains/gcc.py#L74-L76), we (Mbed OS) configure the softfp floating point ABI.

The calling conventoins are discussed in the GCC Arm-specific documentation https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html in the section -mfloat-abi=name. Note that softfp uses hardware floating point. Also note that it is incompatible with hard.

From this point onward, I can’t really help further without knowing the problem you’re trying to solve. Could you explain what problem it is you’re trying to solve, and what you have tried?

1reaction
theotherjimmycommented, Oct 25, 2018

@vrushalibhokare General github tip: add ``` before and after code blocks to format them correctly. I edited your comments to use them. After the top ``` you can also add a language name to get syntax highlighting for that language. I used ```json to get JSON syntax highlighting in your issue description.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cc1plus error: output filename specified twice - Stack Overflow
The problem is that you have -o0 in your command which specifies your output filename to be 0 which conflicts with -o wf_stack_frame.s...
Read more >
cpp.exe: Output filename specified twice - Google Groups
I get the following error when I try to compile code with GCC: cpp.exe: Output filename specified twice
Read more >
gcc detect multiple -o passed on one command line
option with an argument is specified twice, and it only makes sense to specify it once, then the option ... cc1: error: output...
Read more >
Build failed with cc1plus: error: output filename specified twice
I'm having a strange issue with Xcode. If I make a new project in my usual projects directory (/Users/mainframe/Documents/Work/Term 2, 2005/CSCI ...
Read more >
40583 – automatic preprocessing for .F90 or .F95 files fails ...
F95 -mtune=generic -auxbase testf95 -version -fpreprocessed -o /tmp/ccifqF7t.s cc1: error: output filename specified twice ignoring ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found