This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>From: "Limin Zhao" <address@hidden> >Organization: NOAA NESDIS/ORA >Keywords: 200204022010.g32KAAa20458 netCDF SUNWspro c89 f90 g++ Limin, >Thanks for your suggestion. I tried to use gcc instead of c89, >however, I still got the same warning message saying >========== >configure: warning: /usr/local/bin/g++ failed on test program >configure: warning: Could not find working C++ compiler >configure: warning: Setting CXX to the empty string >configure: warning: The C++ interface will not be built >============ My previous comments attempted to address two different issues: o it is a good idea to not try and mix use of the Sun c89 C compiler with the GNU C++ (g++) compiler o there appears to be something wrong with your GNU C++ compiler since it fails to correctly compile a simple test program created by configure. Have you successfully used your g++ compiler to build executables? If so, we need to take a harder look at why configure is failing on the test program it is having g++ compile. >I checked the config.log, the first error message looks like this: > >=== >configure:1243: /usr/local/bin/g++ -o conftest -O -DNDEBUG conftest.C 1>&5 >configure: failed program was: >#line 1230 "configure" >#include "confdefs.h" >#ifdef __cplusplus >extern "C" void exit(int); >#endif > > #include <iostream.h> > int main() { > cout << ""; > return 0; > } >==== Was there more information about how/why the compile failed either before or after this section of the config.log file? Could you send us that file? Also, did you make sure to clean-up after your configure attempts with c89, f90, and g++? configure creates an cache (config.cache) of information it learned from attempts at building simple test programs. This cache will be used on subsequent configure invocations unless it gets deleted. So, you must be careful to clean-up after your previous attempt(s) before trying a new one. This is done in one of two ways: o if configure runs to completion, then make files will be created in each of the subdiretories of the netCDF hierarchy. At this point cleaning up is simple. All you have to run is: make distclean o if configure does not run to completion, presumably it has not created any make files in any of the subdirectories in its hierarchy. Given this, you have to clean up by hand: rm config.log config.status config.cache Makefile If you did not clean-up after your first attempt, please do so now as per the instructions above. Then verify that your CC, FC, and C++ environment variables are what you think they are. Finally, rerun configure. If you still get a configure failure after your clean-up, my first troubleshooting suggestion would be to clip out the lines from the test program that configure is trying to run, put them in a file, and then use g++ "by hand" to compile it. g++ may spit out enough information to let us see why the compile is failing. >I have set the enviroment variable CXX to the g++ compiler, why it dosen't >work. Again, we have to find out why your g++ is not working, or at least not working while being run by configure. >Do you have any suggestion? Try creating a test program with the lines above and see where the build by g++ fails. >Dose anyone there know how to build the netCDF on >the SUN mechine with gcc/g++ Yes. We build using the GNU C and C++ compilers as part of our testing. >and SUN f90? Yes to use of the Sun F90 compiler, but no to the combined use of c89/f90/g++, and no to the combined use of gcc/f90/g++. >Thanks very much for the help. Even after we get your netCDF build using g++ working, there is no guarantee that you will be able to use the combination of gcc/f90/g++. You are in new territory here; that is why I made the comment that _if_ you are successful, we would like to know so that we can pass along your experience to the next person attempting the same thing. Tom