[Qbs] qbs ignores the 'manual' cpp.linkerMode behavior

Jake Petroules Jake.Petroules at qt.io
Tue Oct 10 09:21:39 CEST 2017


Yes, I think your solution seems reasonable. It's possible we might want a similar cpp.assemblerMode option as well, but I'm not sure.

> On Oct 10, 2017, at 9:20 AM, Denis Shienkov <denis.shienkov at gmail.com> wrote:
> 
> Hmm, how, then, about the smart *assembler* options?
> 
> For example, I have an assembler files *.s which contains both asm-code and c-code. It compiles before in Atmel Studio, using the "avr-gcc -x assembler-with-cpp" option. But, in QBS it fails, because QBS launch the 'avr-as' instead of 'avr-gcc', and, seems the 'avr-as' have not similar option, so, future linking fails.
> 
> So, I use workaround:
> 
> cpp.assemblerName: cpp.compilerName
> 
> and pass to cpp.assemblerFlags propery the required compiler options.
> 
> I'm not sure if it is correct decision.
> 
> BR,
> Denis
> 
> 10.10.2017 0:08, Jake Petroules пишет:
>> Indeed it has, and your advice is correct. This is probably a good candidate for our FAQ. I've created a task for it: https://bugreports.qt.io/browse/QBS-1213
>> 
>>> On Oct 9, 2017, at 10:40 PM, timur.kristof at gmail.com wrote:
>>> 
>>> Hi Denis,
>>> 
>>> This issue has been asked several times.
>>> The short answer is this: put the real linker flags without -Wl into
>>> linkerFlags and put the other ones into driverFlags.
>>> 
>>> linkerName and linkerMode are uneeded (as far as I know).
>>> 
>>> Here is an example of how I did it:
>>> https://github.com/Venemo/efm32-qbs-example/blob/master/qbs-custom/impo
>>> rts/ArmMcuProduct.qbs
>>> 
>>> 
>>> 
>>> Hope this helps,
>>> Timur
>>> 
>>> On Mon, 2017-10-09 at 18:32 +0300, Denis Shienkov wrote:
>>>> Hi all,
>>>> 
>>>> I use the AVR-GCC compiler, and I need to use following command line:
>>>> 
>>>> "-nostartfiles -nodefaultlibs -nostdlib -Wl,-
>>>> Map="$(OutputFileName).map" -Wl,--start-group -Wl,-lm  -Wl,--end-
>>>> group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x1f400
>>>> -Wl,-section-start=.ExtReset=0x1e000  -Wl,-section-
>>>> start=.noinit=0x801032  -mmcu=at90can128 -B "C:\Program Files
>>>> (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\at90can
>>>> 128" "
>>>> 
>>>> but, the qbs is too 'intelligent' and generates a wrong command line
>>>> for this options:
>>>> 
>>>> cpp.linkerMode: "manual"
>>>> cpp.linkerName: cpp.compilerName
>>>> 
>>>> cpp.linkerFlags: [
>>>>        "-nostartfiles",
>>>>        "-nodefaultlibs",
>>>>        "-nostdlib",
>>>>        "-Wl,-Map=" + product.targetName + ".map",
>>>>        "-Wl,--start-group",
>>>>        "-Wl,--end-group",
>>>>        "-Wl,--gc-sections",
>>>>        "-Wl,-section-start=.text=0x1f400",
>>>>        "-Wl,-section-start=.ExtReset=0x1e000",
>>>>        "-Wl,-section-start=.noinit=0x801032",
>>>>        "-Wc,-mmcu=" + avrdevice,
>>>>        "-B",
>>>>        "C:/Program Files
>>>> (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.132/gcc/dev/" +
>>>> avrdevice,
>>>>        "-mrelax",
>>>>    ]
>>>> 
>>>> resulting line looks like:
>>>> 
>>>> "
>>>> "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-
>>>> toolchain\bin\avr-gcc.exe" -Xlinker -nostartfiles -Xlinker
>>>> -nodefaultlibs -Xlinker -nostdlib -Xlinker "-Wl,-Map=monitorapp.map"
>>>> -Xlinker "-Wl,--start-group" -Xlinker "-Wl,--end-group" -Xlinker "-
>>>> Wl,--gc-sections" -Xlinker "-Wl,-section-start=.text=0x1f400"
>>>> -Xlinker "-Wl,-section-start=.ExtReset=0x1e000" -Xlinker "-Wl,-
>>>> section-start=.noinit=0x801032" -Xlinker "-Wc,-mmcu=at90can128"
>>>> -Xlinker -B -Xlinker "C:/Program Files
>>>> (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.132/gcc/dev/at90can
>>>> 128" -Xlinker -mrelax
>>>> "
>>>> it insert еру -XLinker flags everywhere...
>>>> 
>>>> How to disable an 'intelligent' feature ?
>>>> 
>>>> BR,
>>>> Denis
>>>> _______________________________________________
>>>> Qbs mailing list
>>>> Qbs at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/qbs
>>> _______________________________________________
>>> Qbs mailing list
>>> Qbs at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/qbs
> 

-- 
Jake Petroules - jake.petroules at qt.io
The Qt Company - Silicon Valley
Qbs build tool evangelist - qbs.io



More information about the Qbs mailing list