ball icon indicating copy to clipboard operation
ball copied to clipboard

fixes for mingw32 cross-compilation

Open anhi opened this issue 10 years ago • 0 comments

Reported by nwoetzel on 28 Oct 44094336 05:23 UTC For PocketOptimizer and Scaffoldselction (http://www.eb.tuebingen.mpg.de/research/research-groups/birte-hoecker/algorithms-and-software.html) we are cross-compiling BALL on Linux for Windows using mingw32 cross compilers (http://mxe.cc) This causes some problems with the current buildsystem. E.g. cmake WIN32 variable is used to set the BALL_BISON_BAT, altough WIN32 is a property for the target system and not the HOST BALL is built on. Within the sources, BALL_COMPILER_MSVC and BALL_OS_WINDOWS is used "detect" if it is a windows build, which causes a few problems. The patch currently only adresse bbuilds without VIEW.

The main problems are: M_PI is apparently not a POSIX standard and not supported by mingw (yet?). Since the Constants namespace contains this constant, one can replace the use of M_PI with Constants:PI

The SYSTEM namespace file and folder classes contain calls to mkdir and lstat, which are different even to the unix calls. I think boost provides a file and directory framework which should be portable.

Similar problems exist for isnan and isfinite - I think boost also provides portable functions here.

There are macros for AND and CONST in some of the windows headers (I think they are not only present in mingw - probably causing problems elsewhere.

Also some cmake related issues: It is not necessary to call LINK_DIRECTORIES on libraries that are detected using the FIND_LIBRARY - since they already contain the absolute path. ADD_CUSTOM_TARGET does not accept EXCLUDE_FROM_ALL - one has to call that on each ADD_EXECUTABLE - the custom target is AFAIK not a dependency of the ALL target - unless it is explicitly added as a dependency.

for windows, there is a "portablexdr" library that can be used to get rpc functionality with mingw (http://people.redhat.com/~rjones/portablexdr/)

in source/COMMON/hash.C hash.C:18:39: error: cast from 'void*' to 'long unsigned int' loses precision [-fpermissive] double d = ((double)((unsigned long)void_ptr)) * 0.6180339887; I am not 100% sure what is intended here - is the cast to "unsigned long" before casting to double really necessary?! If it is, then using e.g. size_t might be a better choice.

anhi avatar Feb 20 '15 04:02 anhi