• Post Reply Bookmark Topic Watch Topic
  • New Topic

Expert guidance needed in understanding the part of a shell script  RSS feed

 
Amit Basnak
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends

I have been trying to achieve some the communication between Client and Server for the SOAP implementation using Systinet Server . I have installed the Systinet Serve 6.5 for C++ on my HP-UX box now while trying to run a simple demo program first , we need to compile the it first on Hp-UX and there is a ./configure script to be run. This configure.sh scrip while running gves an error at CXXFLAGS parameter which is the C++ flags variable that�s used by the configure script of the Systinet system. While running the ./configure script the erorr I m getting is
"error: CXXFLAGS used during compilation of SSC do not work. You are probably using different C++ compiler."

The part of a shell script which has the above error message is as below :
-----------------------------------------------------------
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

{ { echo "$as_me:$LINENO: error: CXXFLAGS used during compilation of SSC do not work.
You are probably using different C++ compiler. The original flags
were: $WASP_CXXFLAGS" >&5
echo "$as_me: error: CXXFLAGS used during compilation of SSC do not work.
You are probably using different C++ compiler. The original flags
were: $WASP_CXXFLAGS" >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

---------------------------------------------------------
I did not understand properly the code part which throws the error.

I would be thankful for all the expert suggestion.
Thank you for your time.
 
Brian Wright
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is clearly only a code segment, but here's a basic analysis of what it's apparently trying to do. It would be easier if the output of the script were given - this script has a lot of debug information in it which will really help you. This script segment is carrying out a three-part if-statement as follows:

A)
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }

This section is actioning the $ac_compile command, defined elsewhere in the script. This section creates the error file 'conftest.err' which it displays to output redirection channel 5 and returns the exit code of the $ac_compile command IE if the compile succeeds return TRUE - we'll call this answer A.

&& (This is a perhaps best considered a connective AND in the overall 'if' statement.)

B)
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }

This section checks to see if the string $ac_cxx_werror_flag is zero length OR if the file conftest.err (created in section A) does not exist or is empty. This section returns the result of the two tests within this section IE if the flag variable is zero length or the file either doesn't exist or it is empty, return TRUE. This is answer B


&& (Again we have an 'AND' statement in the main three-part IF statement.)

C)
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }

This segment tests to see if the file conftest.$ac_objext exists and is non-zero in size. We'll call this answer C.

So - at this point we have three possible failure points. The script is using the following logic:

If (answer A=TRUE) AND (answer B=TRUE) AND (answer C=TRUE) then (carry on) else (display error messages)

The output from your script should show pretty clearly what it's trying to do and the point at which it failed. Check for the destination of output redirection on channel 5 (the >&5), as that's where the debug information is going.


Anyway, that's my two cents worth - take it for what it's worth, it's late on a Friday. Good luck!
 
Amit Basnak
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Brain

Also following the recommendation in the error message; i.e. use the correct C++ compiler? The fact that it comes with a configure script leads me to believe that it is designed to be compiled with the GNU Compiler Collection (gcc).
we have aCC compiler installed. confifure.sh files probably needs to be modified accordingly.

The thing is we cant install gcc compiler due to the requirement from senior manager so have to compile with aCC only.
The current version of aCC compiler installed on our HP-UX is
/orainst/rcsinbg1>what /opt/aCC/bin/aCC
/opt/aCC/bin/aCC:
HP aC++ B3910B A.03.37
HP aC++ B3910B A.03.30 Language Support Library
I executed the command as below on my HP-UX box
/export/home/amitbas/systinet/server_cpp65/share/doc/waspc/demos>./configur�e
CXX= /opt/aCC/bin/aCC CXXFLAGS="-g -O "

and Im posting the errors I have got
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: /opt/aCC/bin/aCC
checking for a BSD-compatible install... ./install-sh -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for /opt/aCC/bin/aCC-gcc... no
checking for gcc... no
checking for /opt/aCC/bin/aCC-cc... no
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
Checking whether we are using the GNU C compiler... no
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of cc... hp
checking for /opt/aCC/bin/aCC-g++... no
checking for /opt/aCC/bin/aCC-c++... no
checking for /opt/aCC/bin/aCC-gpp... no
checking for /opt/aCC/bin/aCC-aCC... no
checking for /opt/aCC/bin/aCC-CC... no
checking for /opt/aCC/bin/aCC-cxx... no
checking for /opt/aCC/bin/aCC-cc++... no
checking for /opt/aCC/bin/aCC-cl... no
checking for /opt/aCC/bin/aCC-FCC... no
checking for /opt/aCC/bin/aCC-KCC... no
checking for /opt/aCC/bin/aCC-RCC... no
checking for /opt/aCC/bin/aCC-xlC_r... no
checking for /opt/aCC/bin/aCC-xlC... no
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking whether cc understands -c and -o together... yes
checking whether ln -s works... yes
checking how to run the C preprocessor... cc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... no
checking for unistd.h... yes
checking for waspc-config...
/opt/systinet/server_cpp65/bin/waspc-config
configure: error: CXXFLAGS used during compilation of SSC do not work.
You are probably using different C++ compiler. The original flags
were:
---------------------------------------------------------------------------�------------------------------------------------------
In spite of the mentioning the location of aCC comiler for compiling that is
./configure CXX=/opt/aCC/bin/aCC CXXFLAGS="-g -O "
we are still getting the errors ,
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the configure output, it's not clear that the script has found any C++ compiler at all. It says it can't find a long list of different C++ compilers, including aCC.

So can you compile a C++ "Hello, World" yourself from the command line? Has anyone ever compiled any C++ code on this machine?

If you know for sure that you have a particular C++ compiler installed, then perhaps you can tell the configure script about it. Try

./configure --help

to see a list of options the script supports. It should mention the environment variable CXX; setting CXX to the path to a valid C++ compiler may help the configure script do its thing.
 
Amit Basnak
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ernest Friedman-Hill and Brian
I was able to compile it successfully
The command I gave was
/export/home/amitbas/systinet/server_cpp65/share/doc/waspc/demos>./configur�e
CXX= /opt/aCC/bin/aCC

I verified with the The log file: config.log entries are correct and
configure exited with 0 status that's success!
1381 configure: exit 0
Thank you for all your help.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!