[CMake] Script running gcc does not come back

Jörg Förstner Joerg.Foerstner at ubidyne.com
Mon Jul 27 11:55:27 EDT 2009


Hi,

I could solve the problem in the meantime. I've put "exit" at the end of the script and I found out that calling g++ also with the linker flags was a problem.

@Tyler:
With this script I've now solved the problem adding "-frandom-seed=<checksum>" to gcc's argument list by bypassing the direct call of gcc and first calling my script.
(See my question "How to calculate a value "on the fly" for use with gcccompiler option?", Fr 17-Jul-2009)

The script looks like this now:
------------------------
#!/bin/bash

COMPILING=FALSE

# Get filename of current source file from list of arguments
for argument in $@ ;do
  if [ "$COMPILING" = "TRUE" ]; then
    FILENAME=$argument
  fi
  if [ "$argument" = "-c" ]; then
    COMPILING=TRUE
  fi
done

if [ "$COMPILING" = "TRUE" ]; then
  # Calculate source file's checksum and add the argument "-frandom-seed=<checksum>"
  CHECKSUM=`md5sum $FILENAME | sed 's/\(.*\) .*/\1/'`
  # Append the argument to the list of given arguments
  args="$@ -frandom-seed=$CHECKSUM"
  # Call compiler with modified argument list
  /home/jf0068/ws/MCU_int/MCU/Tools/ELDK/usr/bin/ppc_82xx-gcc $args
else
  # Call linker with unmodified argument list
  /home/jf0068/ws/MCU_int/MCU/Tools/ELDK/usr/bin/ppc_82xx-gcc $@
fi
exit
------------------------

Cheers,
Joerg

> -----Ursprüngliche Nachricht-----
> Von: Tyler Roscoe [mailto:tyler at cryptio.net] 
> Gesendet: Montag, 27. Juli 2009 17:03
> An: Jörg Förstner
> Cc: cmake at cmake.org
> Betreff: Re: [CMake] Script running gcc does not come back
> 
> On Mon, Jul 27, 2009 at 01:49:18PM +0200, Jörg Förstner wrote:
> > I try to bypass CMake's direct call of gcc, by running a 
> script "compile.sh" instead. The script would allow me to 
> first extend the gcc arguments to my needs and then call gcc.
> > After calling "make" everything is built fine, but in the 
> end, the prompt does not come back. I have to press <CTRL-C> 
> to have the shell prompt back.
> > What do I do wrong?
> 
> Sounds like compile.sh doesn't know how to exit properly or how to run
> concurrently properly (are you passing -j flags to make?).
> 
> What does your compile.sh look like?
> 
> tyler
> 


More information about the CMake mailing list