LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-19-2013, 02:41 AM   #1
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Rep: Reputation: 16
Missing separator on patchinc to C code


Hello:
This question is addressed to specialists in C/C++ programming.

On patching a plugin to a computational C code everything runs plainly unless lapack libraries and C++ libraries are linked, as required for a special feature of the plugin. I tried linking along many routes, including full paths, as with:

LIBS="-L/usr/lib/x86_64-linux-gnu/ -lgfortran -L/usr/lib/lapack/ -llapack -L/lib/x86_64-linux-gnu/ -lm -L/usr/lib/ -lblas -L/lib/x86_64-linux-gnu/ -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/4.6/ -lstdc++"

With the line "LIBS= " left blank, patching occurs. With lapack, and dependencies, and c++ libs defined, as above, the error is:


...........................
...........................
Hunk #4 succeeded at 403 with fuzz 3 (offset 51 lines).

Hunk #5 succeeded at 429 (offset 53 lines).

-- Executing post script

plumed.inc:39: *** missing separator. Stop.


- DONE!

xxxxxxxxxxxxxxxxxx
Up to "Hunk #5", it is normal output, and hunking is complete. The "missing separator" error comes out whichever is done, except leaving the line "LIBS=" blank.

My question is whether the information given is sufficient to understand whether a correction is needed to the patch code. In the area where "plumed.inc" is mentioned, it reads:

{
echo -n "PLUMED_OBJECTS="
for file in $plumedir/common_files/*.c
do f=${file##*/}
echo " \\"
echo -n " \$(DSTDIR)/${f%.c}.o"
done
echo
if [ "$RECON_LIBS" != "" ] ; then
for file in $plumedir/recon_src/*.cpp
do f=${file##*/}
echo " \\"
echo -n " \$(DSTDIR)/${f%.cpp}.o"
done
echo " "
echo "RECON_FLAGS=\$(COPTD)RECONMETAD"
else
echo " "
echo "RECON_FLAGS="
fi
echo "RECON_LIBS="$RECON_LIBS
} > $WHERE_LINKS/plumed.inc

cd $myarch ; ln -s $WHERE_LINKS/plumed.inc .; make depends ; cd ../
}


To me ":39" is particularly confusing. If it refers to line number, then it is not pointing to the area where "plumed.in" is first mentioned. Rather, much earlier.

thanks indeed

chiendarret
 
Old 03-19-2013, 07:32 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
It looks like you have more need of help from someone knowing bash programming, not someone knowing C/C++ programming.

Quote:
Originally Posted by chiendarret View Post
To me ":39" is particularly confusing. If it refers to line number, then it is not pointing to the area where "plumed.in" is first mentioned.
The 39 is a line number. But it is a line number inside the file plumed.inc, not a line number in the script that creates and uses plumed.inc

The code you quoted creates plumed.inc

Some other code, that I don't think you showed uses plumed.inc. But I don't know how plumed.inc is used nor what exactly prints the error message about line 39 of plumed.inc

I expect that after the whole action fails, the file plumed.inc ought to still exist. If you look at the portion around line 39, you ought to get some idea what is wrong with it, which then could be back tracked to what is wrong with the bash code that created it.

Last edited by johnsfine; 03-19-2013 at 07:36 PM.
 
1 members found this post helpful.
Old 03-20-2013, 01:06 PM   #3
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
missing separator

hello:
You are right (believe me, after posting I also realized that :39 refers to plumed.inc but badly failed to find the file; a simple "locate' was now enough). That plumed.inc is formed, on patching, into /maindir/src and reads:
(line 39 is the mere "/" after line "$(DSTDIR)/testderivatives.o")

PLUMED_OBJECTS= \
$(DSTDIR)/biasexchange.o \
$(DSTDIR)/dafed.o \
$(DSTDIR)/hills.o \
$(DSTDIR)/metadyn.o \
$(DSTDIR)/ptmetad.o \
$(DSTDIR)/read_restraint.o \
$(DSTDIR)/restraint_adf.o \
$(DSTDIR)/restraint_alfabeta.o \
$(DSTDIR)/restraint_alpharmsd.o \
$(DSTDIR)/restraint_angle.o \
$(DSTDIR)/restraint_antibetarmsd.o \
$(DSTDIR)/restraint.o \
$(DSTDIR)/restraint_cmap.o \
$(DSTDIR)/restraint_coord.o \
$(DSTDIR)/restraint_dihcor.o \
$(DSTDIR)/restraint_dipole.o \
$(DSTDIR)/restraint_dist.o \
$(DSTDIR)/restraint_elstpot.o \
$(DSTDIR)/restraint_energy.o \
$(DSTDIR)/restraint_func.o \
$(DSTDIR)/restraint_hbonds.o \
$(DSTDIR)/restraint_helix.o \
$(DSTDIR)/restraint_histogram.o \
$(DSTDIR)/restraint_mindist.o \
$(DSTDIR)/restraint_parabetarmsd.o \
$(DSTDIR)/restraint_pca.o \
$(DSTDIR)/restraint_poly.o \
$(DSTDIR)/restraint_position.o \
$(DSTDIR)/restraint_puckering.o \
$(DSTDIR)/restraint_rdf.o \
$(DSTDIR)/restraint_rgyr.o \
$(DSTDIR)/restraint_spath.o \
$(DSTDIR)/restraint_sprint.o \
$(DSTDIR)/restraint_torsion.o \
$(DSTDIR)/restraint_waterbridge.o \
$(DSTDIR)/restraint_zpath.o \
$(DSTDIR)/testderivatives.o
\
$(DSTDIR)/recon_basins.o \
$(DSTDIR)/recon_cbind.o \
$(DSTDIR)/recon_metad.o \
$(DSTDIR)/recon_ppca.o \
$(DSTDIR)/recon_testderivatives.o \
$(DSTDIR)/recon_utils.o
RECON_FLAGS=$(COPTD)RECONMETAD
RECON_LIBS=-L/usr/lib/x86_64-linux-gnu/ -lgfortran -L/usr/lib/lapack/ -llapack -L/lib/x86_64-linux-gnu/ -lm -L/usr/lib/ -lblas -L/lib/x86_64-linux-gnu/ -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/4.6/ -lstdc++

In contrast, when the line RECON_LIBS= is left blank, patching occurs, "make depends" does its job, and "make" compiles the patched main code. In this case, the last portion of /src/plumed.inc reads:

$(DSTDIR)/restraint_torsion.o \
$(DSTDIR)/restraint_waterbridge.o \
$(DSTDIR)/restraint_zpath.o \
$(DSTDIR)/testderivatives.o

RECON_FLAGS=
RECON_LIBS=

What is wrong about line 39? Or what else?

At any event, thanks a lot for your kind advice.

chiendarret
 
Old 03-20-2013, 01:12 PM   #4
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
missing separator

Must add, if relevant, that, as opened with emacs, the whole block after line 39 "/" is left displaced by 8 characters from the preceding block of PLUMED_OBJECTS.

chiendarret
 
Old 03-20-2013, 01:27 PM   #5
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
Perhaps I should also add that when patching with line "RECON_LIBS=" left blank, the patching command triggers a large number of dependencies, the same that are later seen on command "make depends".

When the libraries are linked, patching ends at "missing separator", no depencies are made and "make depends' does not work.

chiendarret
 
Old 03-20-2013, 01:47 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
I am most definitely NOT a skilled bash programmer. So you still might need help from such a programmer.

But it seems obvious where the extra newline is getting injected into the constructed file. I marked in red the command that I think should not be there.

Code:
{
    echo -n "PLUMED_OBJECTS="
    for file in $plumedir/common_files/*.c
      do f=${file##*/}
      echo "    \\"
      echo -n "    \$(DSTDIR)/${f%.c}.o"
    done
    echo
    if [ "$RECON_LIBS" != "" ] ; then
      for file in $plumedir/recon_src/*.cpp
        do f=${file##*/}
        echo "  \\"
        echo -n " \$(DSTDIR)/${f%.cpp}.o"
      done
      echo " "
      echo "RECON_FLAGS=\$(COPTD)RECONMETAD"
    else
      echo " "
      echo "RECON_FLAGS="
    fi
    echo "RECON_LIBS="$RECON_LIBS
  } > $WHERE_LINKS/plumed.inc

  cd $myarch ; ln -s $WHERE_LINKS/plumed.inc .; make depends ; cd ../
}
Quote:
Originally Posted by chiendarret View Post
(line 39 is the mere "/" after line "$(DSTDIR)/testderivatives.o")
...
What is wrong about line 39? Or what else?
What is wrong is that the \ alone on line 39 was supposed to be at the end of line 38.

I don't know what harm is done by having a \ alone on line 39. Most likely no harm. But not having a \ on the end of line 38 totally messes up the parsing of the file, so the next thing that gets read (line 39) will be misunderstood.

Last edited by johnsfine; 03-20-2013 at 01:53 PM.
 
1 members found this post helpful.
Old 03-21-2013, 04:18 AM   #7
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
That clarifies the issue. Thanks indeed.
However, how to get "\" at the end of line 38? Generation of plumed.inc is from the patching script, a portion of which (dealing with plumed.inc) I posted initially. Below the full patching script, which is simply run with

./patchingscript.sh -patch

It would be great if you suggest a correction.
chiendarret

#!/bin/bash
# PATCH SCRIPT FOR NAMD 2.7
#

# USER DEFINED ARCHITECTURE:
myarch="Linux-x86_64-g++"

# this script needs to be launched from the root directory of the host code
destination="$PWD"

# definitions specific to this code
CODE="namd2.9"
LINKED_FILES="$plumedir/common_files/*.h $plumedir/common_files/*.c"
RECON_LINKS="$plumedir/recon_src/*.cpp $plumedir/recon_src/*.h"
WHERE_LINKS="./src/"
# Leave this line here blank for normal patching of plumed
RECON_LIBS=
# CVS version only : for reconnaissance metadynamics enter here information on the
# locations of the lapack and lstdc++ libraries.
RECON_LIBS="/usr/lib/lapack/liblapack.so.3gf.0 /usr/lib/x86_64-linux-gnu/libstdc++.so.6"

# this changes the names from .c to .C
PLUMED_RENAME_RULE=plumed_rename_rule
function plumed_rename_rule (){
case "$1" in
(*.c) echo "${1%.c}.C" ;;
(*) echo "$1" ;;
esac
}

# this changes the names from .cpp to .C
RECON_RENAME_RULE=recon_rename_rule
function recon_rename_rule (){
case "$1" in
(*.cpp) echo "${1%.cpp}.C" ;;
(*) echo "$1" ;;
esac
}

function to_do_before_patch () {
echo > /dev/null
}

function to_do_after_patch () {
{
echo -n "PLUMED_OBJECTS="
for file in $plumedir/common_files/*.c
do f=${file##*/}
echo " \\"
echo -n " \$(DSTDIR)/${f%.c}.o"
done
echo
if [ "$RECON_LIBS" != "" ] ; then
for file in $plumedir/recon_src/*.cpp
do f=${file##*/}
echo " \\"
echo -n " \$(DSTDIR)/${f%.cpp}.o"
done
echo " "
echo "RECON_FLAGS=\$(COPTD)RECONMETAD"
else
echo " "
echo "RECON_FLAGS="
fi
echo "RECON_LIBS="$RECON_LIBS
} > $WHERE_LINKS/plumed.inc

cd $myarch ; ln -s $WHERE_LINKS/plumed.inc .; make depends ; cd ../
}

function to_do_before_revert () {
rm $myarch/plumed.inc; rm $WHERE_LINKS/plumed.inc
}

function to_do_after_revert () {
cd $myarch ; make depends ; cd ../
}

#########

NAME="$0"
source $plumedir/patches/patch_tool.sh
 
Old 03-21-2013, 09:19 AM   #8
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192Reputation: 1192
Quote:
Originally Posted by chiendarret View Post
However, how to get "\" at the end of line 38?
I thought I had explained that.

There is an echo command in the script which I think should be removed. I identified that in red in my previous post. (I hope your browser is showing you colors).

That echo command is responsible for the line break between lines 38 and 39 of plumed.inc. If you remove that echo command, then those two lines of plumed.inc will be merged together (which I think is what you need).

Quote:
It would be great if you suggest a correction.
Remove line 52 of the full script you quoted, that is the echo right before:
if [ "$RECON_LIBS" != "" ] ; then
 
1 members found this post helpful.
Old 03-21-2013, 10:54 AM   #9
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
Hello:
I corrected plumed.inc according to your suggestion: moved "\" from line 39 to the end of line 38 and no blank line with the following. "make depends" issued the dependencies and "make" compiled the main program.
Still to check if everything is in order (which will also depends on the link to the libraries) but the main program executables were generated. I'll check in a few days, now busy.

thanks a lot
chiendarret
 
Old 03-21-2013, 11:01 AM   #10
chiendarret
Member
 
Registered: Mar 2007
Posts: 245

Original Poster
Rep: Reputation: 16
SOLVED missing-separator

I did not notice your suggestion

Remove line 52 of the full script you quoted, that is the echo right before:
if [ "$RECON_LIBS" != "" ] ; then

or I preceded your suggestion, when I adjusted plumed.inc and posted.

I'll check the executable as soon as I am finished with a new affair. At any event, I'll implement your suggestion. Thanks
chiendarret
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile:15: *** missing separator. Stop. AnasAmer Linux - Software 9 08-13-2011 04:22 AM
[SOLVED] missing separator error z050 Linux - Newbie 14 08-29-2010 10:50 AM
Missing Separator in makefile ? mohabic Linux - Newbie 2 01-23-2010 01:11 PM
spamassassin: makefile missing separator Andreja Linux - Software 1 05-31-2004 11:39 AM
Missing Separator? jamespetts Linux - Software 2 09-05-2002 01:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration