RE: problems configuring with fastcgi

Jiann-Ming Su <[email protected]> Thu, 8 Apr 2004 00:56:01 -0400 (EDT)
Newsgroups gmane.comp.gcc.cgicc.general
Message-ID <Pine.LNX.4.44.0404080051260.17716-400000@callimachus.library.emory.edu>
On Wed, 7 Apr 2004, Stephen F. Booth wrote:

> The demos are not required to use FastCGI with cgicc.  I still haven't
> had a chance to look into you problem; what link errors do you get now?
> 

I've included the .h and .cpp files I modified and the output of make as
attachments.

-- 
Jiann-Ming Su  [email protected]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division

_______________________________________________
help-cgicc mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/help-cgicc
FCgiIO.h (text/plain, 4 KB)
/* -*-c++-*- */
/*
 *  $Id: FCgiIO.h,v 1.2 2002/12/04 17:04:07 sbooth Exp $
 *
 *  Copyright (C) 2002 Steve McAndrewSmith
 *  Copyright (C) 2002 Stephen F. Booth
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _FCGIIO_H_
#define _FCGIIO_H_ 1

#ifdef __GNUG__
#  pragma interface
#endif

/*! \file FCgiIO.h
 * \brief Class that implements input and output through a FastCGI request.
 *
 * This class provides access to the input byte-stream and environment
 * variable interfaces of a FastCGI request.  It is fully compatible with the
 * Cgicc input API.
 *
 * It also provides access to the request's output and error streams, using a
 * similar interface.
 */

#include <ostream>
#include <string>
#include <map>

#include "fcgio.h"

#include "cgicc/CgiInput.h"

namespace cgicc {

  // ============================================================
  // Class FCgiIO
  // ============================================================
  
  /*! \class FCgiIO FCgiIO.h FCgiIO.h
   * \brief Class that implements input and output through a FastCGI request.
   *
   * This class provides access to the input byte-stream and environment
   * variable interfaces of a FastCGI request.  It is fully compatible with the
   * Cgicc input API.
   *
   * It also provides access to the request's output and error streams, using a
   * similar interface.
   */
  class CGICC_API FCgiIO : public cgicc::CgiInput, public std::ostream
  {
  public:
    
    // ============================================================
    
    /*! \name Constructor and Destructor */
    //@{
    
    /*!
     * \brief Constructor
     *
     * Create a new FCgiIO object
     */
    FCgiIO(FCGX_Request& request);
    
    /*!
     * \brief Copy constructor
     *
     */
    FCgiIO(const FCgiIO& io);
    
    /*!
     * \brief Destructor
     *
     * Delete this FCgiIO object
     */
    virtual ~FCgiIO();
    //@}
    
    // ============================================================
    
    /*! \name Data Sources */
    //@{
    
    /*!
     * \brief Read data from the request's input stream.
     *
     * \param data The target buffer
     * \param length The number of characters to read
     * \return The number of characters read
     */
    virtual inline size_t read(char *data, size_t length)
    {
      return FCGX_GetStr(data, length, fRequest.in);
    }
    
    /*!
     * \brief Query the value of an environment variable stored in the request.
     *
     * \param varName The name of an environment variable
     * \return The value of the requested environment variable, or an empty
     * string if not found.
     */
    virtual inline std::string getenv(const char *varName)
    {
      return fEnv[varName];
    }
    //@}
    
    // ============================================================
    
    /*! \name Data Target Streams */
    //@{
    
    /*!
     * \brief Provides access to the error stream.
   */
    inline std::ostream& err(void)
    {
      return fErr;
    }
    //@}
    
  protected:
    FCGX_Request& 			fRequest;
    fcgi_streambuf 			fOutBuf;
    fcgi_streambuf 			fErrBuf;
    std::ostream 			fErr;
    std::map<std::string, std::string> 	fEnv;
  };
  
} // namespace cgicc

#endif /* ! _FCGIIO_H_ */
FCgiIO.cpp (text/plain, 1.8 KB)
/*
 *  $Id: FCgiIO.cpp,v 1.3 2003/07/13 14:21:58 sbooth Exp $
 *
 *  Copyright (C) 2002 Steve McAndrewSmith
 *  Copyright (C) 2002 - 2003 Stephen F. Booth
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*#ifdef __GNUG__
#  pragma implementation
#endif*/

#include <iostream>
#include <stdexcept>
#include <cstdlib>

#include "FCgiIO.h"

cgicc::CGICC_API FCgiIO::FCgiIO(FCGX_Request& request)
  : std::ostream(&fOutBuf),
	 fRequest(request), 
	 fOutBuf(request.out), 
	 fErrBuf(request.err), 
	 fErr(&fErrBuf)
{
  rdbuf(&fOutBuf);
  fErr.rdbuf(&fErrBuf);

  // Parse environment
  for(char **e = fRequest.envp; *e != NULL; ++e) {
    std::string s(*e);
    std::string::size_type i = s.find('=');
    if(i != std::string::npos)
      throw std::runtime_error("Illegally formed environment");
    fEnv[s.substr(0, i)] = s.substr(i + 1);
  }
}

cgicc::CGICC_API FCgiIO::FCgiIO(const FCgiIO& io)
  : CgiInput(io),
    std::ostream(&fOutBuf),
	 fRequest(io.fRequest), 
	 fErr(&fErrBuf), 
	 fEnv(io.fEnv)
{
  rdbuf(&fOutBuf);
  fErr.rdbuf(&fErrBuf);
}

cgicc::CGICC_API FCgiIO::~FCgiIO()
{
}
make.out (text/plain, 3.3 KB)
Making all in cgicc
make[1]: Entering directory `/opt/src/cgicc-3.2.2/cgicc'
make  all-am
make[2]: Entering directory `/opt/src/cgicc-3.2.2/cgicc'
make[2]: Leaving directory `/opt/src/cgicc-3.2.2/cgicc'
make[1]: Leaving directory `/opt/src/cgicc-3.2.2/cgicc'
Making all in doc
make[1]: Entering directory `/opt/src/cgicc-3.2.2/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/src/cgicc-3.2.2/doc'
Making all in support
make[1]: Entering directory `/opt/src/cgicc-3.2.2/support'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/src/cgicc-3.2.2/support'
Making all in demo
make[1]: Entering directory `/opt/src/cgicc-3.2.2/demo'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/src/cgicc-3.2.2/demo'
Making all in contrib
make[1]: Entering directory `/opt/src/cgicc-3.2.2/contrib'
/bin/sh ../libtool --mode=link g++  -Wall -W -pedantic -I/opt/include -save-temps  -L/opt/lib -o fcgi-test.cgi  fcgi-test.o FCgiIO.o ../cgicc/libcgicc.la -lfcgi++ -lfcgi 
g++ -Wall -W -pedantic -I/opt/include -save-temps -o .libs/fcgi-test.cgi fcgi-test.o FCgiIO.o  -L/opt/lib ../cgicc/.libs/libcgicc.so /opt/gnu/lib/./libstdc++.so -L/opt/src/gcc-3.3.3/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/src/gcc-3.3.3/i686-pc-linux-gnu/libstdc++-v3/src/.libs -L/opt/src/gcc-3.3.3/gcc /opt/lib/libfcgi++.so /opt/lib/libfcgi.so -lnsl -Wl,--rpath -Wl,/opt/lib -Wl,--rpath -Wl,/opt/gnu/lib/.
FCgiIO.o: In function `cgicc::FCgiIO::FCgiIO[in-charge](FCGX_Request&)':
FCgiIO.o(.text+0x3ff): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o(.text+0x41c): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0x429): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0x438): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0x760): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o: In function `cgicc::FCgiIO::FCgiIO[in-charge](cgicc::FCgiIO const&)':
FCgiIO.o(.text+0x9d4): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o(.text+0x9f1): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0x9fe): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xa0d): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xb3d): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o: In function `cgicc::FCgiIO::~FCgiIO [in-charge]()':
FCgiIO.o(.text+0xd41): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xd4e): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xd5d): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xdfc): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o(.text+0xe1b): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o: In function `cgicc::FCgiIO::~FCgiIO [in-charge deleting]()':
FCgiIO.o(.text+0xed3): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xee0): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xeef): undefined reference to `vtable for cgicc::FCgiIO'
FCgiIO.o(.text+0xf8e): undefined reference to `VTT for cgicc::FCgiIO'
FCgiIO.o(.text+0xfad): undefined reference to `VTT for cgicc::FCgiIO'
collect2: ld returned 1 exit status
distcc[20122] ERROR: compile on localhost failed
make[1]: *** [fcgi-test.cgi] Error 1
make[1]: Leaving directory `/opt/src/cgicc-3.2.2/contrib'
make: *** [all-recursive] Error 1