Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-13 Thread Samuel Thibault
Andrew Helwer, le Fri 13 Jan 2012 18:16:16 +0100, a écrit :
> libhwloc.lib(traversal.o) : error LNK2019: unresolved external symbol 
> __ms_vsnpr
> intf referenced in function snprintf

Do you also link msvcrt in? mingw needs it for almost everything.

Samuel


Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-12 Thread Samuel Thibault
Andrew Helwer, le Fri 13 Jan 2012 01:35:27 +0100, a écrit :
> It fails with the following:
> 
> *** Warning: linker path does not have real file for library -lgdi32.

Ah, that's a dark bug in libtool.

> gcc -I/cygdrive/c/hwloc-asdf/include -I/cygdrive/c/hwloc-asdf/include 
> -I/cygdriv
> e/c/hwloc-asdf/includedolib.c   -o dolib
> ./dolib "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 
> 10.0/VC/bin/lib
> " X86 .libs/libhwloc.def libhwloc- .libs/libhwloc.lib
> The system cannot find the path specified.
> "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/lib" 
> /machi
> ne:X86 /def:.libs/libhwloc.def /name:libhwloc- /out:.libs/libhwloc.lib failed
> Makefile:758: recipe for target `.libs/libhwloc.lib' failed

Well, AIUI, you don't actually need the shared version, so you can as
well pass --disable-shared to ./configure to just get rid of this bug.

That said, isn't the just-uploaded-to-hwloc-website win64 build enough
for you?  It contains the libhwloc.a static build in lib/

Samuel


Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-12 Thread Andrew Helwer
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.hel...@acceleware.com


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-boun...@open-mpi.org [mailto:hwloc-users-
> boun...@open-mpi.org] 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-us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
Z:\WORKSPACE\hello-hwloc>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fomain.obj /c main.cpp /TP /nologo /Iinclude\windows
main.cpp
include\windows\hwloc/bitmap.h(61) : error C3646: '__attribute__' : unknown over
ride specifier
include\windows\hwloc/bitmap.h(61) : error C2065: '__malloc__' : undeclared iden
tifier
include\windows\hwloc/bitmap.h(61) : error C2072: 'hwloc_bitmap_alloc' : initial
ization of a function
include\windows\hwloc/bitmap.h(64) : error C3646: '__attribute__' : unknown over
ride specifier
include\windows\hwloc/bitmap.h(64) : error C2065: '__malloc__' : undeclared iden
tifier
include\windows\hwloc/bitmap.h(64) : error C2072: 'hwloc_bitmap_alloc_full' : in
itialization of a function
include\windows\hwloc/bitmap.h(76) : error C3646: '__attribute__' : unknown over
ride specifier
include\windows\hwloc/bitmap.h(76) : error C2065: '__malloc__' : undeclared iden
tifier
include\windows\hwloc/bitmap.h(76) : error C2072: 'hwloc_bitmap_dup' : initializ
ation of a function
include\windows\hwloc/bitmap.h(213) : error C3646: '__attribute__' : unknown ove
rride 

Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-12 Thread Samuel Thibault
Andrew Helwer, le Tue 10 Jan 2012 02:08:46 +0100, a écrit :
> the Visual Studio compiler runs into a lot of issues.

What kind of issues for instance?

Samuel


Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-12 Thread Samuel Thibault
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


Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-11 Thread Andrew Helwer
> To be clear: I think you're misunderstanding what --enable-embedded-
> mode is for.  Per Samuel's comment, I think you want --enable-static
> (and possibly --disable-shared).

Ah yes, I was misunderstanding the purpose of --enable-embedded-mode. I 
understand now, and also use the --enable-static and --disable-shared flags. I 
have been able to successfully compile into only a static library with headers 
on Linux, but Windows is still giving me some trouble.

I've installed MinGW and Cygwin, and specified HWLOC_MS_LIB as the path to the 
VS lib tool when running configure. Make works just fine (although the include 
directory isn't set properly, but that's easy to work around) until the Windows 
library linking stage:

C:\hwloc-1.3.1>make
Making all in src
make[1]: Entering directory `/cygdrive/c/hwloc-1.3.1/src'
  CC topology.lo
  CC traversal.lo
  CC distances.lo
  CC topology-synthetic.lo
  CC topology-xml.lo
  CC bind.lo
  CC cpuset.lo
  CC misc.lo
  CC topology-windows.lo
topology-windows.c: In function 'hwloc_win_get_VirtualAllocExNumaProc':
topology-windows.c:323:30: warning: assignment from incompatible pointer type [e
nabled by default]
topology-windows.c:328:28: warning: assignment from incompatible pointer type [e
nabled by default]
topology-windows.c: In function 'hwloc_look_windows':
topology-windows.c:469:36: warning: assignment from incompatible pointer type [e
nabled by default]
topology-windows.c:470:38: warning: assignment from incompatible pointer type [e
nabled by default]
  CCLD   libhwloc_embedded.la
copying selected object files to avoid basename conflicts...
  CCLD   libhwloc.la
libtool: link: warning: `-version-info/-version-number' is ignored for convenien
ce libraries
copying selected object files to avoid basename conflicts...
gcc -I/cygdrive/c/hwloc-1.3.1/include -I/cygdrive/c/hwloc-1.3.1/include -I/cygdr
ive/c/hwloc-1.3.1/includedolib.c   -o dolib
./dolib "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/lib
" X86 .libs/libhwloc.def libhwloc- .libs/libhwloc.lib
The system cannot find the path specified.
"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/lib" /machi
ne:X86 /def:.libs/libhwloc.def /name:libhwloc- /out:.libs/libhwloc.lib failed
Makefile:758: recipe for target `.libs/libhwloc.lib' failed
make[1]: *** [.libs/libhwloc.lib] Error 1
make[1]: Leaving directory `/cygdrive/c/hwloc-1.3.1/src'
Makefile:450: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

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?

Thanks,

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.hel...@acceleware.com


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 






Re: [hwloc-users] Compiling hwloc into a static library on Windows and Linux

2012-01-09 Thread Samuel Thibault
Andrew Helwer, le Tue 10 Jan 2012 02:08:46 +0100, a écrit :
> First of all, is Windows 64-bit supported? There is only a 32-bit release on
> the downloads page.

I have never tried to build a 64bit binary, but there is little reason
it should fail.

> However, when I specify the --enable-embedded-mode flag in configure in Linux,
> no libraries are built at all - the specified prefix directory contains only
> empty directories.

But the library is built, it's just not installed because projects often
prefer to link the library in, or something similar. If you want to
install libhwloc.a, simply fetch it from src/.libs/

> I've managed to compile a working static library on Linux using the headers
> generated by configure,

I'm not sure to understand. Doesn't passing --enable-static to
./configure already generate a static library?

> but am having a lot of difficulty doing the same on Windows - the
> Visual Studio compiler runs into a lot of issues. Is there a simple
> way to do this?

I have to say I know basically nothing about what Visual Studio expects
from a static library.

Samuel