Page 1 of 1

Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 9:47 pm
by plong
How can I get wildcards to work in post-build commands? If I use a wildcard file reference in a post-build command, such as

cp $WRKSPC/boost/usr/lib/libboost_system.so.* $PRJROOT/filesys/fs/usr/lib

I get this output when I build the project:

Executing Post Build commands ...
cp: cannot stat `/home/plong/workspace/boost/usr/lib/libboost_system.so.*': No such file or directory

This command works when I enter it in a bash shell. It also works as a post-build command if I remove the wildcard, as in

cp $WRKSPC/boost/usr/lib/libboost_system.so.1.52.0 $PRJROOT/filesys/fs/usr/lib

What gives?

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 10:07 pm
by eranif
plong wrote:cp $WRKSPC/boost/usr/lib/libboost_system.so.* $PRJROOT/filesys/fs/usr/lib
Where did you define WRKSPC and PRJROOT ?

Are these environment variables? If yes, then codelite should replace them with their proper content.
However, if you defined them somewhere in your ~/.bashrc or something similar, you should make sure to start codelite from the terminal that these variables are defined.

You could also define them within codelite from Settings -> Environment variables

Eran

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 10:29 pm
by plong
Oh, yeah, they're exported from ~/.profile. They get expanded correctly as you can see in the build output, so that's not the issue. The problem is with the *.

For example, this works:
cp $WRKSPC/boost/usr/lib/libboost_system.so.1.52.0 $PRJROOT/filesys/fs/usr/lib
but this doesn't:
cp $WRKSPC/boost/usr/lib/libboost_system.so.* $PRJROOT/filesys/fs/usr/lib

Just to make sure, I replaced those variables with their values, and * still doesn't work.

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 10:37 pm
by plong
Oh, I wonder if this is the culprit. Does CodeLite execute those commands in a bash shell with the -f option? If so, bash doesn't do filename expansion, and the cp command is trying to copy a file with an asterisk in the filename. If this is the cause, is there a workaround, or is there any way to enable filename expansion?

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 10:46 pm
by eranif
plong wrote:They get expanded correctly as you can see in the build output
/me looks harder, but still can't see the build output

I think that posting the *complete build log* of your problem will clear things up

Eran

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 11:01 pm
by plong
Sorry. In my query, I said,
If I use a wildcard file reference in a post-build command, such as

cp $WRKSPC/boost/usr/lib/libboost_system.so.* $PRJROOT/filesys/fs/usr/lib

I get this output when I build the project:

Executing Post Build commands ...
cp: cannot stat `/home/plong/workspace/boost/usr/lib/libboost_system.so.*': No such file or directory
Those last two lines appear in the Build tab of Output View. That's what I meant by "build output."

I think this pretty much proves that $WRKSPC expands to /home/plong/workspace. But, like I said earlier, I replaced those variables with their values and still get the same, "cannot stat" error message, so shell parameter expansion is a red herring.

I've been poking around some more and am pretty sure file expansion is disabled for custom build steps http://www.gnu.org/software/bash/manual ... -Expansion.

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 11:15 pm
by eranif
plong wrote:Oh, I wonder if this is the culprit. Does CodeLite execute those commands in a bash shell with the -f option? If so, bash doesn't do filename expansion, and the cp command is trying to copy a file with an asterisk in the filename
For custom build projects (you should have mentioned this earlier...) - codelite wraps all the post-build commands in a temporary script file and execute it with '/bin/sh -f' ... this is a bug which is now fixed in git head

Eran

Re: Wildcard doesn't work in post-build command

Posted: Thu Apr 18, 2013 11:16 pm
by plong
Sorry. Thanks for your attention.