Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong address model when compiling boost

I have written a program that mixes Python 3 and C++. I am using boost-python 1.62 and mingw on Windows. I have compiled the C++ python libs on many, many machines so far and it has always worked well. Now I gave the sources to a colleague for installation on his machine, and compilation fails with mingw complaining about problems with symbols and 'file format not recognized'.

What I see, though, is the following: On my machine b2 reports this at the start of compile:

  • 32-bit : no (cached)
  • 64-bit : yes (cached)
  • arm : no (cached)
  • mips1 : no (cached)
  • power : no (cached)
  • sparc : no (cached)
  • x86 : yes (cached)
  • symlinks supported : yes

On my colleague's machine it looks like this:

  • 32-bit : yes (cached)
  • arm : no (cached)
  • mips1 : no (cached)
  • power : no (cached)
  • sparc : no (cached)
  • x86 : yes (cached)
  • symlinks supported : yes

I am quite sure that the problems have to do with his system trying to compile 32-bit code and trying to link existing 64-bit code to it. The question is, though, why is it trying to compile 32 bit code in the first place? The machine is less than a year old, so it is definitely 64 bits. The more important question, however, is, how can I persuade the machine to compile with 64 bits?

By the way, this is my user-config.jam:

using python : 3.6 : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\python.exe
  : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\include
  : C:\\StreamTest\\WinPython-64bit-3.6.6.2\\python-3.6.6.amd64\\libs
  : ;
like image 405
zeus300 Avatar asked Jul 16 '20 08:07

zeus300


1 Answers

Your colleague is definitely compiling to 32-bit, you could add the argument -m64 which should force mingw to compile to 64-bit (assuming your colleague has a version which supports cross compatibility i.e. mingw-w64)

I assume your colleague downloaded http://www.mingw.org/ but he/she needs: http://mingw-w64.org

From mingw.org:

"MinGW is a native Windows port of the GNU Compiler Collection (GCC), with freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. Although (currently) offering only a 32-bit compiler suite, all of MinGW's software will execute on the 64bit Windows platforms."

From mingw-w64.org:

"Mingw-w64 is an advancement of the original mingw.org project, created to support the GCC compiler on Windows systems. It has forked it in 2007 in order to provide support for 64 bits and new APIs. It has since then gained widespread use and distribution. "

like image 100
alexisdevarennes Avatar answered Nov 03 '22 18:11

alexisdevarennes