LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-25-2009, 11:35 PM   #1
biplabbijay
Member
 
Registered: Jul 2009
Posts: 89

Rep: Reputation: 15
Question Error Message : collect2: ld returned 1 exit status


Hi, I am a trying to run a *.b file which should result an executable file.i have set my environment as follows:




#######################################################
export CPPMAKEOPT="-MM"
export CPPCOMPILE="g++ -c "
export CPPLINK="g++ "
export CPPCOMPILED="g++ -g -c "
export CPPLINKD="g++ -g "
export FORTRAN77="g77"
export ARCOMMAND="ar -rs"
export WCPPLIB=$HOME
export WCPPLIBOBJ=$WCPPLIB/wcpplib
export CERNLIB=/home/hecrrc/cern/pro/lib
export SPACKLIB="-L/home/hecrrc/cern/pro/lib -lpacklib_noshift -lnsl"
export CFLIBSERV="-lg2c"


export USE_HBOOK=1
export USE_SRANLUX=1
export USE_CPP_SRANLUX=1

#FORTRAN LIBRARY SETTINGS
#################################################################################################### ##

export FORTLIBARIES

if [ ! -z"USE_HBOOK" ]; then
echo "Will link with fortran CERN libraries"
export FORTLIBARIES="$SPACKLIB -L$CERNLIB -lkernlib -lmathlib $CFLIBSERV"
fi
#########
if [ ! -z"USE_CPP_SRANLUX" ]; then
echo "Will link with fortran CERN libraries"
export FORTLIBARIES="$WCPPLIBOBJ/ranluxint.o $SPACKLIB -L$CERNLIB -lkernlib -lmathlib $CFLIBSERV"
fi

#################################################################################################### ##

export CLHEP_INCL=$HOME/CLHEP/include

#CLHEP LIBRARY SETTINGS
#################################################################################################### ##

export CLHEPROOT="/home/hecrrc/CLHEP/lib"
export CLHEPLIBNAME="CLHEP"


if [ ! -z"$CLHEP_INCL" ]; then
export ICLHEP_INCL="-l$CLHEP_INCL"
export LCLHEPROOT="-L$CLHEPROOT -l$CLHEPLIBNAME"


else

export ICLHEP_INCL
export LCLHEPROOT
fi

#################################################################################################### ##
if [ ! -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH=/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
fi

export HEED_PREF="$HOME"
export HEEDDIR="$HEED_PREF/heed++"
export HEED_DATABASE="$HOME/heed++/database"

export PATH="$PATH:$WCPPLIBOBJ/install"

################################################################





the *.b file is as follows:




##############################################################
setenv FORTLIBARIES

if ( $?USE_HBOOK ) then
echo "Will link with fortran CERN libraries"
setenv FORTLIBARIES "$SPACKLIB -L$CERNLIB -lkernlib -lmathlib $CFLIBSERV"
endif
if ( $?USE_CPP_SRANLUX ) then
else
echo "Will link with fortran CERN libraries"
setenv FORTLIBARIES "$WCPPLIBOBJ/ranluxint.o $SPACKLIB -L$CERNLIB -lkernlib -lmathlib $CFLIBSERV"
endif
#

if ( $?CLHEP_INCL ) then
setenv ICLHEP_INCL -I$CLHEP_INCL
setenv LCLHEPROOT "-L$CLHEPROOT -l$CLHEPLIBNAME"
else
echo "variable CLHEP_INCL which point to CLHEP is not accessible"
echo "setting ICLHEP_INCL to empty"
setenv ICLHEP_INCL
setenv LCLHEPROOT
endif

if ( $?USE_HBOOK ) then
echo "HBOOK will be linked"
setenv USE_GRAPH USE_HBOOK
else if ( $?USE_OPEN_SCIENTIST ) then
echo "OPEN_SCIENTIST will be linked"
setenv USE_GRAPH USE_OPEN_SCIENTIST
else if ( $?USE_GHIST ) then
echo "GHIST will be linked"
setenv USE_GRAPH USE_GHIST
else if ( $?USE_HISTOG ) then
echo "Histog will be linked"
setenv USE_GRAPH USE_HISTOG
endif

if ( $?USE_CPP_SRANLUX ) then
echo "Will compile by case 1: with SRANLUX implemented through cpp"
setenv DUSE_CPP_SRANLUX "-DUSE_CPP_SRANLUX"
else
echo "Will compile by case 2: with SRANLUX implemented in fortran"
setenv DUSE_CPP_SRANLUX
endif

echo run compiler


$CPPLINKD -I$WCPPLIB -I$HEED_PREF \
-DFUNNAMESTACK -DDO_CHECKS -DALR_CHECK_BOUND \
-D$USE_GRAPH \
-DUSE_SRANLUX $DUSE_CPP_SRANLUX $ICLHEP_INCL -DFORT_UNDERSCORES_01 \
-o Spectr_ts.e Spectr_ts.c \
$HEEDDIR/PhotoAbsCSLib.o -L$HEEDDIR -lheed \
$WCPPLIBOBJ/histdef.o \
$WCPPLIBOBJ/math/linexi2.o \
$WCPPLIBOBJ/matrix/inverse.o \
-L$WCPPLIBOBJ -lutil -lstream -lsafetl -lgraph -lmath -lmatrix -lrandom -lmatter -lioniz -lparticle -lgparticle -lgeom \
$LCLHEPROOT
$FORTLIBARIES
############################################################




when i tried to run it using command "./*.b ", it shows an error;



collect2: ld returned 1 exit status
-L/home/hecrrc/cern/pro/lib: Command not found.



i am using suse linux version 11.0 and my login shell is bash shell.should i change all the "setenv" commands in *.b by "export" or is ther any other way to fix the problem without this changing ? Thanks in advance
 
Old 11-26-2009, 05:46 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

It looks like the real problem is that your "*.b" file is using C shell syntax.

Q: Do you have the C shell loaded on your system?
Quote:
whereis csh
Maybe the easiest approach is to a) install csh (if you don't already have it), and b) modify the first line of each of your "*.b" files to invoke the C shell, e.g.{code]
#!/bin/csh
...[/code]

Plan B is to change all of your *.b files to Bourne syntax (including, but not limited to, changing all of your "setenv" commands).

'Hope that helps .. PSM
 
  


Reply



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
collect2: ld returned 1 exit status kvijaik Linux - Software 2 10-07-2009 09:17 PM
collect2: ld returned 1 exit status Ritendra Linux - Newbie 2 07-30-2009 07:39 AM
ld: cannot find -lc collect2: ld returned 1 exit status ArbuZz Linux From Scratch 3 09-27-2005 12:52 AM
collect2: ld returned 1 exit status abirami Linux - Software 0 03-02-2005 01:07 AM
konstruct error collect2: ld returned 1 exit status X2O Linux - Software 2 08-11-2004 08:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 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
Open Source Consulting | Domain Registration