Hi, today i tried to compile ReactOS with gcc 4.1.2 under RosBE 0.3.4 (previously i used both gcc 3.4.5 and gcc 4.1.2, with a previous svn revision). Before trying to switch compilers i have successfully built an iso image with gcc 3.4.5. So, i issued a make clean in the gcc 3.4.5 enviroment. Then i changed to gcc 4.1.2 and issued a make bootcd (with current SVN). In the building process i got this error message:
[CC] lib\intrlck\i386\compareexchange.c [AR] obj-i386\lib\intrlck\intrlck.a [LD] output-i386\dll\ntdll\ntdll.dll [RSYM] output-i386\dll\ntdll\ntdll.dll [LD] output-i386\dll\win32\kernel32\kernel32.dll obj-i386\dll\win32\kernel32\misc\dllmain.o: In function `InterlockedCompareExchange@12': d:/reactos/current/include/psdk/intrin.h:110: undefined reference to `__sync_val_compare_and_swap_4' obj-i386\dll\win32\kernel32\misc\dllmain.o: In function `InterlockedIncrement@4': d:/reactos/current/include/psdk/intrin.h:139: undefined reference to `__sync_fetch_and_add_4' obj-i386\dll\win32\kernel32\misc\dllmain.o: In function `InterlockedDecrement@4': d:/reactos/current/include/psdk/intrin.h:139: undefined reference to `__sync_fetch_and_add_4' obj-i386\dll\win32\kernel32\misc\dllmain.o: In function `InterlockedExchangeAdd@8': d:/reactos/current/include/psdk/intrin.h:139: undefined reference to `__sync_fetch_and_add_4' collect2: ld returned 1 exit status mingw32-make: *** [output-i386\dll\win32\kernel32\kernel32.dll] Error 1
I'm using ReactOS Build Environment 0.3.4-4.1.2-20061229-prerelease-patched. Probably i could comment the gcc version checking in intrin.h to get this to compile, but that isn't nice/right :P.
As far as i know __sync_* functions are supplied by the compiler and they should be present in gcc 4.1.2. Is this right?
Anyone got an idea why this doesn't work?
Thanks in advance for your help, Best regards, Logan_V8
d:\reactos\current>echo __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ > p.txt
d:\reactos\current>cpp < p.txt cc1.exe: warning: is shorter than expected # 1 "<stdin>" # 1 "<built-in>" # 1 "<command line>" # 1 "<stdin>" 4 * 10000 + 1 * 100 + 2
Commit by greatlrd :: r25685 reactos/tools/rbuild/backend/mingw/mingw.cpp: fixed oarch being use. some have remove oarch flags when ros being compile. now we add it back. for mingw
Thanks greatlord, this patch fixed the problem. (it happens that gcc should compile with march above or equal to i486 to have this intrinsics enabled) http://sourceware.org/ml/libc-alpha/2007-01/msg00060.html
Best regards, Logan_V8