coin-or-tools / BuildTools

Macros and patches for GNU autotools
https://coin-or-tools.github.io/BuildTools/
Other
3 stars 7 forks source link

mingw32 cross-compiling cbc fail int #103

Closed svigerske closed 4 years ago

svigerske commented 5 years ago

Issue created by migration from Trac.

Original creator: ikus060

Original creation time: 2013-09-08 00:09:54

Assignee: @svigerske

Version: 0.7

I do have problem to cross-compile cbc for windows using mingw32 on debian wheezy. On a fresh install, I've proceed as follow:

sudo apt-get install subversion build-essential gcc-mingw-w64 mingw-w64 mingw32
svn co https://projects.coin-or.org/svn/Cbc/stable/2.8 coin-cbc-2.8
cd coin-cbc-2.8
./configure --host=i686-w64-mingw32
make

make failed with the following error:

CoinOslFactorization.cpp: In function 'void* clp_align(void*)':
CoinOslFactorization.cpp:901:5: error: 'int64_t' was not declared in this scope
CoinOslFactorization.cpp:901:15: error: expected ';' before 'k'
CoinOslFactorization.cpp:902:10: error: 'k' was not declared in this scope
CoinFinite.hpp: At global scope:
CoinFinite.hpp:18:14: warning: 'COIN_DBL_MAX' defined but not used [-Wunused-variable]
CoinFinite.hpp:20:14: warning: 'COIN_INT_MAX_AS_DOUBLE' defined but not used [-Wunused-variable]
make[3]: *** [CoinOslFactorization.lo] Error 1
make[3]: Leaving directory `/home/debian/coin-cbc-2.8/CoinUtils/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/debian/coin-cbc-2.8/CoinUtils/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/debian/coin-cbc-2.8/CoinUtils'
make: *** [all-recursive] Error 1

Attached is my config.log

svigerske commented 5 years ago

Attachment config.log by ikus060 created at 2013-09-08 00:10:06

svigerske commented 5 years ago

Comment by ikus060 created at 2013-09-08 00:51:13

I forgot to mention. Cross compiling for windows 64bits is working from linux 64bits. I'm doing the following:

sudo apt-get install subversion build-essential gcc-mingw-w64 mingw-w64
svn co https://projects.coin-or.org/svn/Cbc/stable/2.8 coin-cbc-2.8
cd coin-cbc-2.8
export LDFLAGS="-static-libgcc -static-libstdc++"
./configure --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
make

Meaning the problem is related to cross-compiling for windows 32 bits from a linux 64 bits is not working.

svigerske commented 5 years ago

Comment by @svigerske created at 2013-09-08 16:07:54

Can you try if it works if you modify CoinUtils/src/CoinTypes.hpp to include stdint.h in any case?

--- CoinTypes.hpp
+++ CoinTypes.hpp
`@``@` -7,9 +7,7 `@``@`
 #define _CoinTypes_hpp

 #include "CoinUtilsConfig.h"
-#ifdef __MINGW64__
 #include <stdint.h>
-#endif

 #define CoinInt64 COIN_INT64_T
 #define CoinUInt64 COIN_UINT64_T
svigerske commented 5 years ago

Comment by ikus060 created at 2013-09-08 22:29:02

Thanks! Your modification make it work. To allow the same base code to be compiled for i686 and x86_64, what would be the right #ifdef ??

svigerske commented 4 years ago

The change that removes the check for __MINGW64__ has been removed in CoinUtils a while ago.

Maybe crosscompiling is working now, but I haven't tried this and don't plan to do this effort. I'll close this here for now and assume that someone will open an issue in CoinUtils if there is still a problem.