Compilation error(s) with gcc4.1

Hi to everybody!

I have the same compilation errors during compilation of Root source for all Root versions (I tested 4.04.02f-5.17.04) under gcc4.1 (but no problem under gcc3.4, gcc3.3). The system is ALT Linux 4.0 Desktop on Athlon2600+.

The compiler prints:

[ul]
gcc -O2 -pipe -m32 -Wall -W -fPIC -Iinclude -DG__REGEXP -DG__UNIX -DG__SHAREDLIB -DG__OSFDLL -DG__ROOT -DG__REDIRECTIO -DG__STD_EXCEPTION -pthread -o cint/src/g__cfunc.o -c cint/src/g__cfunc.c
cint/src/g__cfunc.c:50: error: expected declaration specifiers or ‘…’ before numeric constant
cint/src/g__cfunc.c:50: error: expected ‘)’ before ‘!=’ token
cint/src/g__cfunc.c:50: error: expected ‘)’ before ‘?’ token
make: *** [cint/src/g__cfunc.o] Error 1
[/ul]

I have found that this error is due to incorrect definition of the macros
memcpy
I corrected this error by
#undef memcpy
in the file g__cfunc.o:

#undef memcpy // my new line

#if defined(G__ANSI) || defined(G__ANSIHEADER)
int memcmp(const void *region1,const void *region2,size_t count);
void* memcpy(void *region1,const void *region2,size_t n);
#elif defined(_AIX)

But then (after a long time of compilation) I have new compilation error:

[ul]
==> lib/libCint.so done
g++ -m32 -O2 -o bin/cint cint/main/cppmain.o
-Llib -lCint -lm -ldl -rdynamic
lib/libCint.so: undefined reference to dlsym' lib/libCint.so: undefined reference todlerror’
lib/libCint.so: undefined reference to dlopen' lib/libCint.so: undefined reference todlclose’
collect2: ld have been finished with code 1
make: *** [bin/cint] Error 1
[/ul]

What does it mean and whether it may be corrected?

Cheers,
Alexander

[quote]What does it mean and whether it may be corrected? [/quote]Usually the library libdl.so (requested by -ldl on the link line contains the implementation for those functions (dlopen, etc.). They might be in a different library on your platform …

Philippe

Thank you very much.

I checked the library libdl.so and found that everything is Ok. More over, I compiled the test program:

// Test.C
#include <dlfcn.h>

int main()
{
  dlerror();
  return 0;
}

The command line to compile was

[ul]
g++ -O Test.C -ldl -rdynamic
[/ul]

I have obtained wery well a.out program - the library libdl.so is visible and valid. So, I can’t understand why Root coul nod be compiled.

Alexander

Hi,
does your test still work when you add -m32?
Axel.

Thank you for the idea.

I tested the command line

g++ -O -m32 Test.C -ldl -rdynamic

and everything was Ok again.

Alexander

Hi there,
trying to compile root version 5.18 and version 5.29 on my Mac, the system is Snow Lepoard, I get the same error. I am using gcc version 4.2
any idea how to solve this?
Cornelia

The compiler prints:

[ul]
gcc -O2 -pipe -m32 -Wall -W -fPIC -Iinclude -DG__REGEXP -DG__UNIX -DG__SHAREDLIB -DG__OSFDLL -DG__ROOT -DG__REDIRECTIO -DG__STD_EXCEPTION -pthread -o cint/src/g__cfunc.o -c cint/src/g__cfunc.c
cint/src/g__cfunc.c:50: error: expected declaration specifiers or ‘…’ before numeric constant
cint/src/g__cfunc.c:50: error: expected ‘)’ before ‘!=’ token
cint/src/g__cfunc.c:50: error: expected ‘)’ before ‘?’ token
make: *** [cint/src/g__cfunc.o] Error 1
[/ul]

Hi,

This error should not appear in v5.29 (I can not reproduce it) but is indeed likely with v5.18 which has not been ported to the newer compiler. I would recommend trying the fix mentioned by Alexander:[quote]I have found that this error is due to incorrect definition of the macros
memcpy
I corrected this error by
#undef memcpy
in the file g__cfunc.o:

CODE: SELECT ALL
#undef memcpy // my new line

#if defined(G__ANSI) || defined(G__ANSIHEADER)
int memcmp(const void *region1,const void region2,size_t count);
void
memcpy(void *region1,const void *region2,size_t n);
#elif defined(_AIX)[/quote]

Cheers,
Philippe.

Dear Rooters,
I dropped for a while the installation on my Mac of the newest root version. However, when trying again with gcc.4.2 having downloaded the source especially for MAC OS X 10.6 there is no configure file produced after doing “tar”. Is this normal? The same happens when trying to install the older version 5.18 using the gcc-4.1. No configure file.

Thanks Cornelia

[quote=“pcanal”]Hi,

This error should not appear in v5.29 (I can not reproduce it) but is indeed likely with v5.18 which has not been ported to the newer compiler. I would recommend trying the fix mentioned by Alexander:[quote]I have found that this error is due to incorrect definition of the macros
memcpy
I corrected this error by
#undef memcpy
in the file g__cfunc.o:

CODE: SELECT ALL
#undef memcpy // my new line

#if defined(G__ANSI) || defined(G__ANSIHEADER)
int memcmp(const void *region1,const void region2,size_t count);
void
memcpy(void *region1,const void *region2,size_t n);
#elif defined(_AIX)[/quote]

Cheers,
Philippe.[/quote]

[quote]having downloaded the source especially for MAC OS X 10.6 there is no configure file produced after doing “tar”. Is this normal? [/quote]Humm … you might actually have downloaded the binary build for MacOS in which case you do not have the source and do not have configure file (since you can no longer configure not rebuild anyway).

Philippe.

Dear Philippe

thanks for the quick reply!
So downloading the binary build for MacOS and doing “gunzip” and “tar” I get a fully functioning root version? I wasn’t simply sure about this since I am not an expert in software issues.

[quote=“pcanal”][quote]having downloaded the source especially for MAC OS X 10.6 there is no configure file produced after doing “tar”. Is this normal? [/quote]Humm … you might actually have downloaded the binary build for MacOS in which case you do not have the source and do not have configure file (since you can no longer configure not rebuild anyway).

Philippe.[/quote]

[quote]So downloading the binary build for MacOS and doing “gunzip” and “tar” I get a fully functioning root version?[/quote]Yes (well you may still have to setup the environment (see the documentation for that)).

Cheers,
Philippe.