[Qbs] cpp.linkerFlags and bare-metal

Marcel r00tc0d3 at mienstee.nl
Wed May 31 20:12:23 CEST 2017


Hi All,

I am using qt creator with qbs already for some years now to create bare metal software. From qbs 1.6 I already got warnings about the cpp.linkerFlags and the escaping of -Wl, or -Xlinker. Till now I could not find a solution so I ignored it. But with qbs 1.8 there is no ignoring possible :-)

I used to use the cpp.linkerFlags like this.

    cpp.linkerFlags: [
        "-Xlinker", "-Map="+buildDirectory+"/"+name+".map",
        "-Wl,--gc-sections",
        "-mcpu=cortex-m4",
        "-mthumb",
        "-mabi=aapcs",
        "-mfpu=fpv4-sp-d16",
        "-mfloat-abi=hard",
        "--specs=nano.specs",
        "--specs=nosys.specs",
    ]

Because of the escaping I removed the -Wl, or -Xlinker. However qbs is now also escaping the other flags which result in a linker error because it does not understand the other parameters. Removing them result also in linker error because I am using hard floats and the linker defaults to soft float. But also the other parameter are needed for proper linking.

Then I tried cpp.linkerMode to prevent escaping. This does not work either. When using g++ as a linkerName it still escapes and behaves like the previous situation. When linkerName is ld nothing can be found because it does not know all the library paths and so on. To keep things simple, and like everybody is using gcc/g++, I want to do the linking by invoking gcc or g++.

The cpp.commonCompilerFlags are not parsed to g++ when linking. Is there a reason for that?

Does anybody know a solution for my problem?

Cheers, Marcel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20170531/b1032d94/attachment.html>


More information about the Qbs mailing list