3

Has anyone managed to build the CUnit library for Windows?

I want to run the same unit tests under Windows that I have currently developed under linux, so I need a windows version of the cunit shared library to link to

I'm struggling badly

have MinGW and MinGW MSYS tools installed so have a gcc compiler and Make and all that

but trying the standard:

./configure
make
make install

fails on ./configure

I've tried installing ftjam and following the instructions in the CUnit README but its failing with:

jam -f Jambase install
Jambase: No such file or directory
don't know how to make install
...found 1 target(s)...
...can't find 1 target(s)...

fast running out of ideas here - any assistance gratefully receveived

bph
  • 10,728
  • 15
  • 60
  • 135
  • *"fails on ./configure"* -- what does the error message say? – Shawn Chin Sep 20 '12 at 14:23
  • 1
    having a litle more luck now with - bash ./configure --prefix=c:/tmp, currently running (slow cos its virtualBox) – bph Sep 20 '12 at 14:26
  • was originally using ./configure but not sure windows knows about shebangs? was getting 'configure' is not recognized as an internal or external command, operable program or batch file. – bph Sep 20 '12 at 14:27
  • 1
    C - UNIIIIIT! - get a build running or die tryin' – im so confused Sep 20 '12 at 14:40

4 Answers4

5

The answer above is wrong. The correct answer is as follows:

libtoolize

automake --add-missing 

autoreconf

./configure --prefix=/mingw

make

make install
Pang
  • 9,564
  • 146
  • 81
  • 122
hubinix
  • 66
  • 1
  • 1
  • theres no configure file in the cunit 2.1-3 tarball - this answer is very useful in that respect – bph Nov 27 '14 at 16:23
  • 1
    I can't understand how I was unable to build CUnit following the instructions in the README file but I've been able to do it with your answer. Thank you. – Claudi Feb 14 '15 at 10:55
  • There is no longer an answer above yours. – Grallen Jul 21 '16 at 06:41
  • This is the correct answer. I did the same with cygwin (and apt-cyg) which solved the no configure file in the latest CUnit tarball – Marvin Effing Oct 07 '19 at 12:29
2

nailed it with the following (already had MinGw and MSYS installed)

mkdir c:/tmp
cd CUnit-2.1-2
bash ./configure --prefix=c:/tmp
make
make install

but i only get libcunit.a not libcunit.dll

i noticed that when i originally built under linux i got a libcunit.so

so looks like only static linking but i think i can live with that

bph
  • 10,728
  • 15
  • 60
  • 135
1

For whatever reason, the source archives don't have the support files for Jam. You can get them from Cunit's SVN repo on SourceForge. You will also need the linker export definition file (libcunit_dll.def)

I opted to patch the Jamfiles (for all of the subdirectories) back onto the released 2.1-2 tree. It looks like there are a couple breaking changes / unclosed defects in the SVN trunk.

Once you have the files:

export MINGW=gcc
export JAM_TOOLSET=MINGW
jam.exe -f Jambase libcunit

will build a proper Windows dll.

gibbss
  • 2,013
  • 1
  • 15
  • 22
1

Anyone interested in building CUnit using Eclipse? I tried and can build it successfully!

[Note]

  • I used CUnit-2.1-2, CUnit-2.1-3 package lacks header file "Cunit.h".
  • Some compilers do not support "curse", so I don't build it.
  • I do not use the makefile in the CUnit package, too.

[Howto]

  1. Create a static-library-C-project in Eclipse using Cygwin or Mingw compiler.
  2. Copy all .h files in CUnit\Headers except Curses.h into your new project then include the folder into build
  3. Copy all .c files in CUnit\Sources\Framework into your project
  4. Copy Automated.c, Basic.c, Console.c into your project
  5. Build the project, you will get the libCUnitLib.a in Archieves folder.
wolverie
  • 11
  • 2