Git files in Qt creator - qt

Sooo, I've been trying to use Qt creator and QGroundControl Open source repository and while trying to build my qgroundcontrol.pro file, the "Issues" bar shows this weird message:
unknown option: -
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--super-prefix=<path>] [--config-env=<name>=<envvar>]
<command> [<args>]
Basicaly I think this is about not beeing able no read git files and it messing up the build.
Has this happen to anyone or am I just this lucky ? (:
I´ve tried searching for help and see the documentation for both Qt creator and QGroundControl and none have anything about this

Related

QMake ignore/edit project file variable

I want to reset LIBS variable of my project without touching pro file itself.
qmake fileName.pro LIBS=
this will not work, because "LIBS=" is performed before loading fileName.pro.
cat fileName.pro | grep -v "LIBS.*=" | qmake /dev/stdin
will not work too, qmake seems to NOT be intended for PIPE-ing.
so is there some other option for editing/ignoring/reseting variable insade qmake command line, without changing pro file.
it was the -after option that i was looking for:
qmake fileName.pro -after LIBS=
works well.

Why changing LD_LIBRARY_PATH has no effect in Ubuntu?

I was trying to deploy my application on Ubuntu 16.04. So i made a package with the following hierarchy -
Package
|
----bin
|
-----application
-----application.sh
-----Qt
|
-----necessary qt libraries
-----platforms
Here is the application.sh file -
#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/Qt
./application
When i execute the application.sh file, it shows me that it cant find the libQt5MultimediaWidgets.so.5 file. But its in the Qt folder. Also when i print the ldd application from the application.sh file after exporting LD_LIBRARY_PATH it gives me following output -
Please check the marked parts. Can anyone please explain why the libraries from the Qt folder are not found even after exporting the LD_LIBARRY_PATH?
Edit:
So as suggested by #Zang, i have checked the debug log and here it is -
Please check the marked parts.
It seems like its actually trying the actual libQt5MultimediaWidgets.so and then report that its unable to find it. Can anyone please help me understand whats happening here?
Edit-2: As per suggestion from #Tarun, i have ran ls -al on my Qt folder. Here is the output -
All files in Your Qt directory are actually simlinks to non-existing files in the same directory, therefore they cannot be found.
If you look at the output of your ls -al
These are soft links that you have. Your softlink libQt5MultimediaWidgets.so.5 points to libQt5MultimediaWidgets.so.5.9.2 in the same directory and the file is not there at all. So you need to either set the correct softlink path or have the file in same directory
First
Could it be that the pwd is not where you assume it is?
You could try adding
# Figure out where the application.sh script is located
scriptpath="$( cd "$(dirname "$0")" ; pwd -P )"
# Make sure our pwd is that location
cd "$scriptpath"
in the top of your script (assumes bash shell, from here)
By doing this all relative paths to Qt folder will be valid.
Second
Maybe you should considder exporting your new LD_LIBRARY_PATH, like so (from here):
LD_LIBRARY_PATH=whatever
export LD_LIBRARY_PATH
Third
It may be useful to run ldconfig command for ld to update after changing the variable (from here):
sudo ldconfig
The file libQt5MultimediaWidgets.so is not present in /Desktop/package/bin/Qt according to the screenshots shown.

QT CreatorL Adding source files from another (parent) directory

My Qt project structure is similar to this:
Directory Structure:
|
|--- dir
| |
| | - a.c
| | - a.h
| | - test.pro
|--- dir1
| | - b.c
| | - b.h
test.pro
SOURCES += a.c \
../dir1/*.c
HEADERS += a.h \
../dir1/*.h
When I try to build the project I get the error:
:-1: error: No rule to make target `../dir1/*.c'
Is there anyway to include source files which are outside the .pro file?
And also have them show in the Projects pane on the left in Qt Creator?
Wildcards in qmake (.pro file) work only for files in current project directory. For subfolders it does not work. So the proper solution is to add each file separately.
The issue was raised on the Qt bug tracker QTCREATORBUG-8925. The ticked is closed as a new feature request or due to multiple problems:
Using wildcards in .pro files creates multiple problems, e.g. adding a
additional file won't automatically compile it. Nor would deleting a
file automatically remove it from the Makefile
However, there is undocumented function listed on the wiki Undocumented_QMake
files(glob) — Returns a list of files which match the specified glob
pattern.
So, if the above problems of using globbing patterns are acceptable it can be used as
SOURCES += $$files(../dir1/*.c)

Is it possible to create a symlink to the latest file in a directory?

I have a home directory in my unix box. I would like to setup a number or shortcuts in it to point to the latest file in another directory and the link will update if a newer file is created.
Is this possible?
So far I able to get the latest file:
ls -lrt | tail -n1
Thanks
[EDIT]
Perhaps I could even create a shell instead of a softlink which finds the latest file and returns it so I can open/grep/delete etc?
In bash, this will make a link to the latest file or directory in "target-directory" called "latest":
ln -s target-directory/`ls -rt target-directory | tail -n1` latest
And this will wait for a change in "target-directory" before returning:
inotifywait -e attrib target-directory

How to copy/update resources, frameworks or plugins to the (Mac OS X) "app bundle" with Qt Creator or qmake

I've been reading for a couple days on how to copy/update external resources, plugins or frameworks to my App's Mac Bundle using Qt creator or qmake.
Right now I have found two main solutions. One is to use qmake together with some commands on the ".pro" file. The other one is to do a "Custom Deployment Step" script.
I was hoping to use the second option cause I already had a small make script that did what I wanted. The problem is that Qt Creator offers so little variables to work with that the script lost its usefulness. For instance, my script uses the "Target App Path" as a parameter so it can do all its work from there. But please correct me if I'm wrong, Qt Creator only offers %{buildDir} and %{sourceDir} variables...
The other option is using qmake. These are the things that I have tried so far on my ".pro" file:
1) Using the INSTALL command. I did a small test where I tried copying some files this way:
MediaFiles.path = test/media
MediaFiles.files = media/*
INSTALL += MediaFiles
And basically nothing happend. I was hopping to find the same "media" folder on the "test" folder but nothing. Don't know if I'm doing something wrong.
Please note that the "media" folder is beside the "test" folder and the ".pro" file. (They all have the same hierarchy position.)
2) Then I tried QMAKE_BUNDLE_DATA:
MediaFiles.path = Contents/MacOS
MediaFiles.files = media/*
QMAKE_BUNDLE_DATA += MediaFiles
But this gave me the following error:
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
make: *** [PathToApp] Error 64
None of the solutions seem to be pleasing so far. If I wanted to do a good custom make script I will need to hardcode every target path separately. In my case I have 8 different target path depending on some "CONFIG" variables.
I'm sure the qmake solution are the official way of doing this. If someone can point me out the solution to the Error 64 would be cool.
Some further question:
Do I have to do a qmake every time I want to update my bundle?
Can I execute my make script with the qmake?
QMAKE_BUNDLE_DATA started working flawlessly after putting the command on the end of the .pro script.
mac{
MediaFiles.files = media
MediaFiles.path = Contents/MacOS
QMAKE_BUNDLE_DATA += MediaFiles
}

Resources