[gmx-developers] compiling with c++
hess at sbc.su.se
hess at sbc.su.se
Sun Jun 27 13:38:21 CEST 2010
Hi,
I fixed the second part of the errors.
But for the first one I don't know exactly what the code it supposed to do.
Erik could you fix those conversion errors?
Berk
> On 2010-06-26 23.21, Sander Pronk wrote:
>> I tried it a couple of days ago and didn't find anything that couldn't
>> be fixed. The recent power outage in Stockholm has prevented me from
>> fixing things, though.
>> Did you find anything particularly worrisome?
>>
> > Sander
> >
>
> It seems hard to believe that anyone successfully compiled the whole
> gromacs with c++ recently...
>
> In single precision, warnings
>
> /Users/spoel/GG/gromacs/src/gmxlib/selection/compiler.c: In function
> void init_root_item(t_selelem*,
> gmx_ana_index_t*):/Users/spoel/GG/gromacs/src/gmxlib/selection/compiler.c:2289:
> warning: comparison between enum e_selelem_t and enum e_selvalue_t
>
> and some more for assignment of char * to constant strings.
>
> Resolution: ignored
>
> Errors:
>
> /Users/spoel/GG/gromacs/src/gmxlib/selection/mempool.c: In function
> void _gmx_s
> el_mempool_free(gmx_sel_mempool_t*, void*):
> /Users/spoel/GG/gromacs/src/gmxlib/selection/mempool.c:169: error:
> invalid conversion from void* to char*
>
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c: In function void
> qsort_swapfunc(void*, void*, size_t, int):
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:43: error: invalid
> conversion from void* to int*
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:44: error: invalid
> conversion from void* to int*
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:54: error: invalid
> conversion from void* to char*
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:55: error: invalid
> conversion from void* to char*
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c: In function void*
> qsort_med3(void*, void*, void*, int (*)()):
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:72: error: too many
> arguments to function
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:74: error: too many
> arguments to function
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:76: error: too many
> arguments to function
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:83: error: too many
> arguments to function
> /Users/spoel/GG/gromacs/src/gmxlib/gmx_sort.c:85: error: too many
> arguments to function
>
> etc.
>
> In both mempool.c and gmx_sort.c I've added type casts, however these
> are not trivial, so it would be good if the authors (Teemu?, Berk?)
> check these.
>
> /Users/spoel/GG/gromacs/src/gmxlib/mtxio.c: In function void
> gmx_mtxio_write(const char*, int, int, real*,
> gmx_sparsematrix_t*):/Users/spoel/GG/gromacs/src/gmxlib/mtxio.c:135:
> error: cannot convert bool* to
> int* for argument 2 to bool gmx_fio_doe_int(t_fileio*, int*,
> const char*, const char*,
> int)/Users/spoel/GG/gromacs/src/gmxlib/mtxio.c: In function void
> gmx_mtxio_read(con
> st char*, int*, int*, real**, gmx_sparsematrix_t**):
> /Users/spoel/GG/gromacs/src/gmxlib/mtxio.c:219: error: cannot convert
> bool* to int* for argument 2 to bool gmx_fio_doe_int(t_fileio*,
> int*, const char*, const char*, int)
>
> These are more tricky: the C++ type bool is not compatible with int.
> Removing the check for booleans
> AC_CHECK_TYPES([bool])
> in configure.ac makes matters worse rather than better.
>
> I introduced new functions gmx_fio_doe_bool and gmx_fio_ndoe_bool that
> converts the bool to an int before writing/reading (in order to keep
> compatible files!).
>
> I replaced the gmx_fio_do_int function by gmx_fio_do_bool also in tpxio.c:
> /Users/spoel/GG/gromacs/src/gmxlib/tpxio.c:464: error: cannot convert
> bool* to int* for argument 2 to bool gmx_fio_doe_int(t_fileio*,
> int*, const char*, const char*, int)
> /Users/spoel/GG/gromacs/src/gmxlib/tpxio.c:466: error: cannot convert
> bool* to int* for argument 2 to bool gmx_fio_doe_int(t_fileio*,
> int*, const char*, const char*, int)
> and so on...
>
> /Users/spoel/GG/gromacs/include/smalloc.h: In function void
> _snew_aligned(const char*, const char*, int, T*&, size_t, size_t,
> size_t) [with T = real]:
> /Users/spoel/GG/gromacs/src/mdlib/tables.c:914: instantiated from here
> /Users/spoel/GG/gromacs/include/smalloc.h:195: error: invalid conversion
> from const char* to char*
> /Users/spoel/GG/gromacs/include/smalloc.h:195: error: initializing
> argument 1 of void* save_calloc_aligned(char*, char*, int, unsigned
> int, size_t, size_t)
> /Users/spoel/GG/gromacs/include/smalloc.h:195: error: invalid conversion
> from const char* to char*
> /Users/spoel/GG/gromacs/include/smalloc.h:195: error: initializing
> argument 2 of void* save_calloc_aligned(char*, char*, int, unsigned
> int, size_t, size_t)
>
> Fixed this by twice adding a typecast to (char *) in the template code
> in smalloc.h line 195.
>
> /Users/spoel/GG/gromacs/src/mdlib/qm_orca.c: In function real
> read_orca_output(
> real (*)[3], real (*)[3], int, t_forcerec*, t_QMrec*,
> t_MMrec*):/Users/spoel/GG/gromacs/src/mdlib/qm_orca.c:248: warning:
> format %s expects type char*, but argument 3 has type int*
>
> Replace %s by %d
>
> g_membed wouldn't compile because gmx_ana.h wasn't included leading to
> name mangling problems.
>
> Then there is a clash between X-windows and MPI: both define a typedef
> Status. Duh! Removed g_showcol from compilation list to side-step this
> issue.
>
> Another tip: I usually compile in separate object directories rather
> than in the source tree. It is a good idea to remove the src etc. before
> you run configure. Now I had a src/gmxlib/version.h from february lying
> around there which was incorrect and caused linking errors.
>
>
> Now in double precision:
> Undefined symbols:
> "_nb_kernel430_x86_64_sse2", referenced from:
> kernellist_x86_64_sse2 in
> libgmx_mpi_d.a(nb_kernel_x86_64_sse2.o)
> "_nb_kernel410_x86_64_sse2", referenced from:
> kernellist_x86_64_sse2 in
> libgmx_mpi_d.a(nb_kernel_x86_64_sse2.o)
> "_nb_kernel400_x86_64_sse2", referenced from:
> kernellist_x86_64_sse2 in
> libgmx_mpi_d.a(nb_kernel_x86_64_sse2.o)
>
>
> This is a name mangling problem and it is fixed by including the
> appropriate header file into the c-files. By the way the comment in this
> file still says:
> * This file is generated automatically at compile time
> * by the program mknb in the Gromacs distribution.
>
> I don't think that is correct anymore, is it?
>
>
> So please test compiling in single and double precision as well as with
> with C compile and C++ compiler.
>
> I have committed these patches, and now everything compiles.
>
>
>
>
>
> --
> David van der Spoel, Ph.D., Professor of Biology
> Dept. of Cell & Molec. Biol., Uppsala University.
> Box 596, 75124 Uppsala, Sweden. Phone: +46184714205.
> spoel at xray.bmc.uu.se http://folding.bmc.uu.se
> --
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
>
More information about the gromacs.org_gmx-developers
mailing list