[Trilinos-Users] Cygwin Build Problems

Michael Sielemann michael.sielemann at gmail.com
Tue Jan 20 08:32:46 MST 2009


Ross,
Thanks for your reply. I certainly understand your remark on the priority of
supporting Cygwin and I appreciate Sandia's generosity to share Trilinos
with the scientific community. That said, my problem was that I understood
that building under Cygwin was really a no-brainer. I took your config and
compile flags as if they were carved in stone and looked for other problems
(Cygwin related, conflicts with other software etc). Turns out that a little
tweaking on the compiler flags does the job. Sorry for being too lazy.

Thanks to everybody for helping me out,

Details are below.

Best regards MICHAEL

----8<-------------------------8<----

When compiling Trilinos with gcc 3.4.4 under current Cygwin g++ complained
that standard routines like strdup() were undeclared (in Zoltan's
driver/dr_main.c for example). Via copy and paste I made up the following
small test.

#include <stdio.h>
#include <string.h>

#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif

int main(void)
{
   char *string = "this is a copy";
   char *newstr;
   /* Make newstr point to a duplicate of
string                              */
   if ((newstr = strdup(string)) != NULL)
      printf("The new string is: %s\n", newstr);
   return 0;
}

#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif

Under current Cygwin, this will not compile with the g++ flag -ansi:

$ g++ -ansi test.c -o mytest.exe
test.c: In function `int main()':
test.c:14: error: `strdup' undeclared (first use this function)
test.c:14: error: (Each undeclared identifier is reported only once for each
function it appears in.)

Using gcc 4 said flags work fine and also on a 32 bit node with Centos 4 and
gcc 3.4.6 they do. So I guess that this was changed between 3.4.4 and 3.4.6
or is a peculiarity/bug/feature of Cygwin (a downgrade to an earlier version
of gcc earlier didn't avoid the error message).

BTW, I tried gcc 4.x under Cygwin earlier, that alone didn't help either. So
I recommend using gcc 3 for now.

Anyway, the following do-configure.sh works fine for libraries and examples
(up to now, tests still have to be compiled). It is based on the script
suggested by Ross earlier.

#!/bin/sh
rm config.cache
../configure --prefix=/cygdrive/f/C_Sandbox/tribox/trilinoslib \
--cache-file=config.cache \
--with-install="/usr/bin/install -p" \
CXXFLAGS="-g -O0 -Wall -fexceptions" \
CFLAGS="-g -O0 -Wall -fexceptions" \
FFLAGS="-g -O0 " \
--enable-export-makefiles \
--with-gnumake \
--disable-default-packages \
--enable-teuchos --enable-teuchos-extended --enable-teuchos-debug
--enable-teuchos-abc --disable-teuchos-blasfloat \
--enable-thyra \
--enable-epetra --enable-epetra-abc \
--enable-triutils --disable-triutils-tests --disable-triutils-examples \
--enable-epetraext \
--enable-amesos \
--enable-aztecoo \
--enable-belos \
--enable-ifpack \
--enable-ml \
--enable-nox --enable-nox-epetra --enable-nox-epetraext --enable-nox-thyra
--enable-nox-thyra-tests --enable-nox-tests \
--enable-loca \
--enable-stratimikos \
--enable-rythmos \
--enable-moocho \
--enable-sacado \
--enable-meros \
--enable-new_package \
--enable-galeri \
--enable-isorropia \
--enable-moertel \
--enable-anasazi \
--enable-didasko

One could add the -pedantic to the C and CXX flags, still.




On Fri, Jan 16, 2009 at 9:03 PM, Bartlett, Roscoe A <rabartl at sandia.gov>wrote:

>  Michael,
>
> I am surprised by all of these problems that you are having with building
> Trilinos on cygwin.  While I have been able to get this to work in the
> past with the packages that I build we don't really have official support
> for Cygwin at this point.  I don't think anyone really does any testing of
> Trilinos on cygwin before a release is put out.  None of our critical
> internal customers rely on cygwin so it is not a high priority.  Cygwin is
> more a convenience for developers who want to do a little work on their
> Windows machine.
>
> Has anyone else on this list be able to get Trilinos 9.0 to build under
> cygwin?
>
> Cheers,
>
> - Ross
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://software.sandia.gov/mailman/private/trilinos-users/attachments/20090120/3999f670/attachment.html 


More information about the Trilinos-Users mailing list