I'm using QBS 1.10.1 in Qt Creator 4.5.1 , under MSYS2.
I would like to pass -s to g++ when invoked for the link step, to reduce the size of the release mode binary. How do I do this?
So far I have tried as suggested by the documentation:
cpp.driverFlags: ["-municode", "-static", "-static-libgcc", "-static-libstdc++"]
Properties {
condition: qbs.configuration === "Release"
cpp.driverFlags: outer.concat("-s")
}
however it does not actually pass the -s in Release mode, i.e. it's as if the Properties block were not there.
Note: The cpp.driverFlags option actually passes flags to all instances of g++, not just link steps; however I have been unable to find a way to only specify flags for the link step. The g++ is smart enough to ignore those flags if it wasn't a link step. The cpp.linkerFlags field actually transforms the flags to a -Wl,"flag" option which is not the right behaviour for these flags.
There are two problems with your code:
You should not test for the value of qbs.configuration, which is an arbitrary string set by users. Instead, use qbs.buildVariant, where "release" (all lower case!) is a known value.
-s is not a driver flag, but an actual linker flag, i.e. an option that ld understands. Therefore, you should use cpp.linkerFlags. The option will be automatically escaped if the gcc frontend is used for linking.
Related
I am using CodeLite for C++ development.
I can edit AVAILABLE options under Settings/Build settings/Compiler Options or /Linker Options.
I can also change the options of a PARTICULAR project under Workspace/Open Active Project Settings...
What I want to do is to change the default settings for ALL projects (or at least for all NEW projects).
In the active project settings the first field is "Use with Global Settings" what implies that somewhere there should be access to these Global Settings, but I do not find. I only found under Build Settings/Advanced the Include Path and the Libraries Path but I do want to make other defaults as well, e.g. for the compiler "C++ Compiler Options" like e.g. .std=c++17 and for the linker "Linker Options" e.g. -pthread and "Libraries".
I make many little projects and it is a nightmare to change all these manually for every little project.
There is no UI to do this, but this can be done.
To apply a new compiler / linker options to your entire workspace, the easiest way to do this is:
Right click on your workspace icon
There are 2 tabs in this view, select the one that says Environment
To add some new compiler options, set the environment variable CXXFLAGS
To add a new linker options, set the environment variable LinkerOptions
For example, in order to compiler all my sources with -std=c++17 and link the binary with -s (strip) linker option, add the following to the environment variable section of the workspace:
CXXFLAGS=-std=c++17 $(CXXFLAGS)
LinkOptions=$(LinkOptions) -s
the CXXFLAGS is only applied to C++ source files e.g. *.cpp or other common extensions like *.cxx, *.cc etc. To set compiler options for C source files, use the environment variable CFLAGS
Notice that I am also concatenating the previous value, this makes sure that the new value does not override the old value, but adds to it
https://doc.qt.io/archives/qt-4.8/qmake-environment-reference.html#installs
To help in the install process qmake has the concept of a install set.
It looks like a install set have members, i.e. path, files and extra:
documentation.path = /usr/local/program/doc
documentation.files = docs/*
Are there other members?
What members need to be set in order to consider the install set fully described?
Where the create_docs come from in the case below
unix:documentation.extra = create_docs; mv master.doc toc.doc
QMake is documented... not. Whenever you want to know something you go browse source code. In this case, it's in qmake/generators/makefile.cpp, function Makefilegenerator::writeInstalls().
As we can see, it's path, files, base, extra, CONFIG, uninstall and depends. extra (or commands) is an arbitrary line to insert at the top.
What members need to be set in order to consider the install set fully described?
QMake is Makefile generator. Whatever human does it simply outputs some Makefile. Whether it will work or not, that's a human's problem.
I've seen the question "How does “make” app know default target to build if no target is specified?", which explains that the default target is the first target that doesn't being with a '.'.
How do I get make to tell me what that target is?
Context: I've got a recursive make system, with a variety of included makefiles. If I add a new target to my top level Makefile (or to my common include), that becomes the default target. I want to add .DEFAULT_GOAL: original-default-target, but I don't know what original-default-target is.
Running make -d results in a lot of debug output. If you search this for the first occurrence of 'Updating goal targets', and look at the next target mentioned, this appears to be the default target.
For example:
$ make -d | grep -A2 -m1 'goal targets'
Updating goal targets....
Considering target file 'all'.
File 'all' does not exist.
This implies that, for this Makefile at least, the current default target is all. This can then be enforced by adding .DEFAULT_GOAL: all to the top-level Makefile.
I am using Qmake command line to build my app for iOS and I am struggling to sign my app with xcodebuild because the MyApp.xcodeproj/project.pbxproj that qmake is generating does not the contain the following fields at all
ProvisioningStyle
DevelopmentTeam
How can enforce qmake to contain ProvisioningStyle $ DevelopmentTeam fields in project.pbxproj?
I dont need to have any certain value to be set into the 2 fields. Only, need the fields to be present in appropriate places in project.pbxproj. Opening & MyApp.xcodeproj in Xcode UI IDE & just checking-unchecking the Automatically manage signing option under Project>General settings adds the fields into project.pbxproj. How can I get qmake to add them for me?
As you know, I answered the DevelopmentTeam detail on this SO thread:
Qt for iOS: code signing is required
You commented that you tried the same pattern for PROVISISIONING_STYLE but did you try ProvisioningStyle? I'm just a bit unclear what you did and what the results were.
When I try to compile this project I get the following error.
I would like to find out more about this error. It says to pass -v to see more information.
How can I do that?
And how can I remove this library from the linker?
Also, and this is an aside question, but does this count as a compiler error, or is it just a link error?
To make your user experience more intuitive, Apple likes to make buttons invisible.
You can click on lines in the build log to make these buttons visible...
To make this interface even more obtuse er... I mean, more intuitive, some lines in the build log have these buttons already showing without needing to be clicked first.
It says, that the linker failed. The previous line is the linker's error message:
ld: library not found for -lPods.
To remove the dependency on the library, go to project’s “Build Settings” tab and remove -lPods from the key named “Other Linker Flags”. Or, if it's not there, open the “Build Phases” tab and look for it in the list named “Link Binary With Libraries”.
It’s a linker, not compiler error.