Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#19 Broken build in Msys and C++ tests fail

closed-fixed
h_ayguen
None
5
3 days ago
2009-05-19
Anonymous
No

I’m currently compiling DUMA 2.5.15 using a MINGW + MSYS environment

gcc-core-4.2.1
gcc-g++-4.2.1
mingw32-make-3.81-20080326.tar.gz
w32api-3.13-mingw32-dev.tar.gz
mingwrt-3.15.2-mingw32-dll.tar.gz
mingwrt-3.15.2-mingw32-dev.tar.gz
binutils-2.19.1-mingw32-bin.tar.gz
gdb-6.8-mingw-3.tar.bz2
mingw-utils-0.3.tar.gz

All the packages are the latest verision.

Doing

mingw32-make OSTYPE=msys

I got the following error messages

createconf.exe
createconf: Platform is MINGW
createconf: WIN32 is set
mingw32-make[1]: Leaving directory `C:/msys/1.0/home/emasgas/duma_2_5_15'
g++ -g -O0 -c dumapp.cpp -o dumapp.o
gcc -g -O0 -c duma.c -o duma.o
gcc -g -O0 -c sem_inc.c -o sem_inc.o
gcc -g -O0 -c print.c -o print.o
print.c: In function 'DUMA_Print':
print.c:329: error: '_O_APPEND' undeclared (first use in this function)
print.c:329: error: (Each undeclared identifier is reported only once
print.c:329: error: for each function it appears in.)
print.c:329: error: '_O_CREAT' undeclared (first use in this function)
print.c:329: error: '_O_WRONLY' undeclared (first use in this function)
mingw32-make: *** [print.o] Error 1

The problem should be in print.c lines

#ifndef WIN32
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/param.h>
#else
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <winbase.h>
#include <io.h>

#ifndef __CYGWIN__
/* already defined in cygwin headers */
typedef LPVOID caddr_t;
#else
/* use these for cygwin */
#include <unistd.h>
#include <fcntl.h>
#endif

An include is missed (fcntl.h), in that header the undeclared symbols are defined. I changed the above lines to

#ifndef WIN32
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/param.h>
#else
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <winbase.h>
#include <fcntl.h>
#include <io.h>

#ifndef __CYGWIN__
/* already defined in cygwin headers */
typedef LPVOID caddr_t;
#else
/* use these for cygwin */
#include <unistd.h>
#include <fcntl.h>
#endif

Just adding #include <fcntl.h>. Now it works. The command mingw32-make OSTYPE=msys gave me the following messages

$ mingw32-make OSTYPE=msys
using default srcdir [.]
using default prefix [/usr]
using default exec_prefix [/usr]
c:/MinGW/bin/mingw32-make reconfig
using default srcdir [.]
using default prefix [/usr]
using default exec_prefix [/usr]
mingw32-make[1]: Entering directory `C:/msys/1.0/home/emasgas/duma_2_5_15'
gcc -g -O0 -DDUMA_SO_NO_LEAKDETECTION -DDUMA_EXPLICIT_INIT -c createconf.c -o createconf.o
createconf.c: In function 'testAlignment':
createconf.c:131: warning: cast from pointer to integer of different size
createconf.c:134: warning: cast to pointer from integer of different size
createconf.c:135: warning: cast to pointer from integer of different size
createconf.c:136: warning: cast to pointer from integer of different size
createconf.c:137: warning: cast to pointer from integer of different size
createconf.c:138: warning: cast to pointer from integer of different size
createconf.c:139: warning: cast to pointer from integer of different size
createconf.c:140: warning: cast to pointer from integer of different size
createconf.c:145: warning: cast to pointer from integer of different size
createconf.c:155: warning: cast from pointer to integer of different size
createconf.c:158: warning: cast to pointer from integer of different size
createconf.c:159: warning: cast to pointer from integer of different size
createconf.c:160: warning: cast to pointer from integer of different size
createconf.c:161: warning: cast to pointer from integer of different size
createconf.c:162: warning: cast to pointer from integer of different size
createconf.c:163: warning: cast to pointer from integer of different size
createconf.c:164: warning: cast to pointer from integer of different size
createconf.c:169: warning: cast to pointer from integer of different size
createconf.c:254: warning: cast from pointer to integer of different size
createconf.c:257: warning: cast to pointer from integer of different size
createconf.c:258: warning: cast to pointer from integer of different size
createconf.c:259: warning: cast to pointer from integer of different size
createconf.c:260: warning: cast to pointer from integer of different size
createconf.c:261: warning: cast to pointer from integer of different size
createconf.c:262: warning: cast to pointer from integer of different size
createconf.c:263: warning: cast to pointer from integer of different size
createconf.c:268: warning: cast to pointer from integer of different size
del /F 2>nul createconf.exe
gcc -g -O0 -DDUMA_SO_NO_LEAKDETECTION -DDUMA_EXPLICIT_INIT createconf.o -o createconf.exe
createconf.exe
createconf: Platform is MINGW
createconf: WIN32 is set
mingw32-make[1]: Leaving directory `C:/msys/1.0/home/emasgas/duma_2_5_15'
g++ -g -O0 -c dumapp.cpp -o dumapp.o
gcc -g -O0 -c duma.c -o duma.o
gcc -g -O0 -c sem_inc.c -o sem_inc.o
gcc -g -O0 -c print.c -o print.o
del /F 2>nul libduma.a
ar crv libduma.a dumapp.o duma.o sem_inc.o print.o
a - dumapp.o
a - duma.o
a - sem_inc.o
a - print.o
ranlib libduma.a
gcc -g -O0 -c tstheap.c -o tstheap.o
del /F 2>nul tstheap.exe
gcc -g -O0 tstheap.o libduma.a -o tstheap.exe
gcc -g -O0 -c dumatest.c -o dumatest.o
del /F 2>nul dumatest.exe
gcc -g -O0 dumatest.o libduma.a -o dumatest.exe
gcc -g -O0 -c thread-test.c -o thread-test.o
del /F 2>nul thread-test.exe
gcc -g -O0 thread-test.o libduma.a -o thread-test.exe
gcc -g -O0 -c testmt.c -o testmt.o
del /F 2>nul testmt.exe
gcc -g -O0 testmt.o libduma.a -o testmt.exe
g++ -g -O0 -c dumatestpp.cpp -o dumatestpp.o
del /F 2>nul dumatestpp.exe
g++ -g -O0 dumatestpp.o libduma.a -o dumatestpp.exe
g++ -g -O0 -c testoperators.cpp -o testoperators.o
testoperators.cpp: In function 'void pure_test()':
testoperators.cpp:200: warning: allocating zero-element array
testoperators.cpp: In function 'void rich_test()':
testoperators.cpp:231: warning: allocating zero-element array
del /F 2>nul testoperators.exe
g++ -g -O0 testoperators.o libduma.a -o testoperators.exe

I got few warnings from testoperators.cpp. The following testing programs are now failing

$ dumatestpp

DUMA Aborting: Failed to post the semaphore.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

$ testoperators.exe
DUMA 2.5.15 (static library, EXPLICIT_INIT)
Copyright (C) 2006 Michael Eddington <meddington@gmail.com>
Copyright (C) 2002-2008 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>

DUMA Aborting: Failed to post the semaphore.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

But “testmt”, “dumatest”, “tstheap.exe 10000” work correctly.

Finally

$ thread-test
Test not implemented for Win32 and Mingw.

I’d like to use duma in C++ , but AFAIK DUMA seems broken in C++.

Discussion

  • Please note that the error in testoperator.cpp is generated in rich_test().

     
  • Please note that the error in dumatestpp comes from sem_inc.c, calling

    if (0 == ReleaseSemaphore(semHandle, 1 /* amount to add to current count */, N
    ULL) )
    DUMA_Abort("Failed to post the semaphore.");

    Using GetLastError() and FormatMessage() (win32 api) I got the following reason for failing ReleaseSemaphore

    Too many posts were made to a semaphore.

    Hope this helps

     
  • h_ayguen
    h_ayguen
    2009-06-12

    • assigned_to: nobody --> h_ayguen
    • status: open --> pending-fixed
     
  • h_ayguen
    h_ayguen
    2009-06-12

    fixed in CVS repository.
    next duma version will contain the fix.

     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending-fixed --> closed-fixed