Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux
From: Andrew Helwer (Andrew.Helwer_at_[hidden])
Date: 2012-01-12 16:52:45


COMPILING HWLOC ON WINDOWS WITH MINGW/CYGWIN

I've attached the output of make V=1 in make_output.txt. I included the demonstration first of it failing because it can't find the include directory, but I just fix that by copy/pasting the contents of include/ into src/.

HWLOC_HAVE_WINDOWS_H is defined to 1 in /include/hwloc/autogen/config.h.

I copied the .def file from the official Windows build into .lib and ran the following from inside src/ (after running vcvars32 bat file to set up environment variables local to the terminal):

C:\hwloc-1.3.1\src>dolib.exe lib.exe X86 .libs/libhwloc.def libhwloc- .libs/libhwloc.lib

This creates a .lib file, but when I use the VS compiler to compile and link against it, it asks for a dll at runtime. I have a couple other things I'll try, but I wanted to get this email off before too long.

Also, prior to VS linking my program with hwloc, there are a few errors that crop up:
* VS does not know what __inline__ means
---- This is fixed by changing the definition of __hwloc_inline from __inline__ to __inline in include/hwloc/autogen/config.h
---- See: http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
* VS spouts out a whole bunch of errors relating to the definition of __attribute__ and __deprecated__
---- This is new in hwloc 1.3.1 - just using the header from 1.3.0 does away with all of these errors
---- The generated headers are the same as in the official releases for 1.3.1 and 1.3.0
---- The error output is attached in the file vs_output.txt

COMPILING HWLOC ON WINDOWS WITH VS

VS apparently has problems when functions are declared as static inline when using its C compiler. A way around this I've found is to explicitly pass it the /TP flag, which makes it use its C++ compiler. A bunch of errors about the identifier '__attribute__' being a syntax error then pop up, however, and I haven't found a way around those yet.

Thanks for all your help so far!

Andrew Helwer
Software Developer  - Intern
Acceleware Ltd. (TSX-V:AXE)
www.acceleware.com

Phone: +1.403.249.9099  ext. 348
Fax: +1.403.249.9881
Email: andrew.helwer_at_[hidden]

Get superpowered!
Acceleware gets your products to market faster, better and stronger!                        

This e-mail may contain information that is privileged and confidential and subject to legal restrictions and penalties regarding its unauthorized disclosure or use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and its attachments from your system. Thank you.
© 2012 Acceleware Ltd., All Rights Reserved

> -----Original Message-----
> From: hwloc-users-bounces_at_[hidden] [mailto:hwloc-users-
> bounces_at_[hidden]] On Behalf Of Samuel Thibault
> Sent: Thursday, January 12, 2012 10:03 AM
> To: Hardware locality user list
> Subject: Re: [hwloc-users] Compiling hwloc into a static library on
> Windows and Linux
>
> Hello,
>
> Andrew Helwer, le Thu 12 Jan 2012 02:11:58 +0100, a écrit :
> > If I run the command manually, it can't find the libhwloc.def file.
> Which is reasonable, as it does not appear to exist in the .lib
> directory. Am I missing something?
>
> In principle the .def file is generated by the linker. Could you run
>
> make V=1
>
> to get the command lines, and check that HWLOC_HAVE_WINDOWS is 1 in
>
> ./include/hwloc/autogen/config.h
>
> ? At worse, I believe you can just copy the libhwloc.def contained in
> the 32bit build of the exact same version of hwloc, it should be
> compatible.
>
> Thanks,
> Samuel
> _______________________________________________
> hwloc-users mailing list
> hwloc-users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users