From: <no...@so...> - 2002-03-01 16:18:15
|
Bugs item #523968, was opened at 2002-02-28 19:00 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=103248&aid=523968&group_id=3248 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Pier Donini (cyberpi) Assigned to: Nobody/Anonymous (nobody) Summary: Solaris compilation Initial Comment: Two bugs while compiling with gcc (2.95.2) under Solaris 8: First in UnixPlatformFactory.cxx the compiler screams about the lines 131 and 140. A typecast to char * seems to be needed: 131: putenv((char *) BzfString::format("%s=%s", name.c_str(), value.c_str()).c_str()); 140: putenv((char *) name.c_str()); Next, while making ui: make[3]: Entering directory `src/ui' g++ -DSUN_OGL_NO_VERTEX_MACROS -DVERSION=10801001 -DINSTALL_DATA_DIR=\/usr/local/lib/bzflag\ -I../../include -DNDEBUG -O -MD -c Menu.cxx Menu.cxx:22: sstream: No such file or directory gmake[3]: *** [Menu.o] Error 1 What am I missing here? A more recent compiler? ---------------------------------------------------------------------- >Comment By: Pier Donini (cyberpi) Date: 2002-03-01 17:18 Message: Logged In: YES user_id=168115 > could you try adding `&& > !defined(sun)' on the #if lines before each putenv and > report the results. This didn't work as setenv() and unsetenv() are unknown. So, I did the following ugly hack for UnixPlatformFactory::setEnv: #if defined(sun) char *s = new char[name.size() + value.size() + 2]; // = and \0 sprintf(s, "%s=%s", name.c_str(), value.c_str()); putenv(s); #elif !defined(__linux__) ... and for UnixPlatformFactory::unsetEnv: #if defined(sun) char *s = new char[name.size() + 1]; strcpy(s, name.c_str()); putenv(s); #elif !defined(__linux__) ... However, this causes a memory leak :( Any better solutions (as calling setEnv("foo=bar") directly, and possibly splitting the string for compilers supporting putenv(a, b)) ? Btw, sstream in my include dir worked fine. Thanks. ---------------------------------------------------------------------- Comment By: Chris Schoeneman (crs23) Date: 2002-02-28 19:29 Message: Logged In: YES user_id=21565 the putenv() problem probably implies older putenv() semantics where the passed string is not copied but put directly into the environment. casting away const is not a solution because the pointed-to memory will disappear when the BzfString goes away. could you try adding `&& !defined(sun)' on the #if lines before each putenv and report the results. sstream is a part of the standard C++ library but apparently wasn't in gcc 2.95.2. however, there is one available. copy the contents of http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00700/sstream to a file named `sstream' (no .h) in the same include directory that `iostream' lives in. or put it in bzflag's include directory if you can't or don't want to modify your system include directory. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=103248&aid=523968&group_id=3248 |