[Qt-creator] file not found for mounted drive
Orgad Shaneh
orgads at gmail.com
Fri Oct 3 09:52:51 CEST 2014
On Fri, Oct 3, 2014 at 2:51 AM, Mohammad Mirzadeh <mirzadeh at gmail.com>
wrote:
> Hi guys,
>
> I have to work with remote files on a server that has its own toolchain.
> As a result I have configured the project on the server, having its own
> .pro and Makefile.
>
> I'd like to be able to edit and build them remotely on my machine. The
> trick i have played here is mounted the server through sshfs and create a
> local dummy project that reads the file on the mounted server. To enable
> remote building I have created a custom build target like this:
>
> remote_build.target = remote_build
> remote_build.commands = ssh server "make -C $$REMOTE_BUILD_DIR"
> QMAKE_EXTRA_TARGETS += remote_build
>
> this does build the project fine. However, I am not able to use QtCreator
> to jump to errors warnings etc since all the error messages have relative
> path on the server. I tried to go around this by the following hack:
>
> remote_build.commands = ssh server "make -C $$REMOTE_BUILD_DIR 2>stderr
> 1>stdout; sed -i 's/server_path/locally_mounted_path/g' stderr stdout; cat
> stdout; cat stderr 1>&2"
>
> Now when I build, the error messages do point to the file which is mounted
> locally and is open in the editor window. However, QtCreator still cannot
> jump to the file, complaining that it does not exist.
>
> Is what i'm trying to do even feasible? is there any better way of
> achieving this? I would really LOVE if Qt Creator had a built-in way of
> building remote targets.
>
> Thanks
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
>
Hi,
I wrote the following helper script for a similar use-case. Use it as a
proxy for your build command. Should be something like:
remote_build.commands = ssh server "cd $$REMOTE_BUILD_DIR &&
./translate_err.sh \"$$PWD\" make"
------
#!/bin/sh
set -o pipefail
normalize()
{
if [ "x$WINDOWS" = "x1" ]; then
sed "s|/|\\\\|g"
else
cat
fi
}
# Runs $2 (e.g. ./build.sh), and translates paths in stderr from local to
remote (given by $1) path
if [ $# -lt 2 ]; then
echo "usage: $0 <local_path> <build_script> [arguments]"
exit 1
fi
# Change if script is executed inside a subdirectory
LOCAL="$PWD"
# Windows -> revert backslashes
if echo $1 | grep -q '^.:'; then
WINDOWS=1
REMOTE="$(echo "$1" | sed 's|\\|/|g')"
else
REMOTE="$1"
fi
shift
RUN="$1"
shift
exec 3>&1
# redirect stderr to stdout and stdout to 3, then restore stdout to stderr
$RUN "$@" 2>&1 1>&3 | sed "s|$LOCAL|$REMOTE|g" | normalize 1>&2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20141003/9c4e6fa0/attachment.html>
More information about the Qt-creator
mailing list