hwloc icon indicating copy to clipboard operation
hwloc copied to clipboard

Remove compiler specific flags.

Open Neumann-A opened this issue 4 years ago • 2 comments

https://github.com/open-mpi/hwloc/blob/58fa0dcf8f99e8856346edcc67fc1bd4d1c0777b/hwloc/Makefile.am#L192

is linker/compiler specific and hinders building with MSVC. I also don't need this flag if I build with MSVC.

Neumann-A avatar Oct 22 '21 10:10 Neumann-A

Possible workaround that I can't test until I have autoconf working with MSVC:

diff --git a/config/hwloc.m4 b/config/hwloc.m4
index b9fa1eb2f..58ab74f86 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -1712,6 +1712,7 @@ AC_DEFUN([HWLOC_DO_AM_CONDITIONALS],[
         AM_CONDITIONAL([HWLOC_BUILD_STANDALONE], [test "$hwloc_mode" = "standalone"])
 
         AM_CONDITIONAL([HWLOC_HAVE_GCC], [test "x$GCC" = "xyes"])
+        AM_CONDITIONAL([HWLOC_HAVE_MSVC], [test "x$hwloc_c_vendor" = "xmicrosoft"])
         AM_CONDITIONAL([HWLOC_HAVE_MS_LIB], [test "x$HWLOC_MS_LIB" != "x"])
         AM_CONDITIONAL([HWLOC_HAVE_OPENAT], [test "x$hwloc_have_openat" = "xyes"])
         AM_CONDITIONAL([HWLOC_HAVE_SCHED_SETAFFINITY],
diff --git a/hwloc/Makefile.am b/hwloc/Makefile.am
index 2f5034e5f..bfa3bcd2d 100644
--- a/hwloc/Makefile.am
+++ b/hwloc/Makefile.am
@@ -189,7 +189,9 @@ if HWLOC_HAVE_WINDOWS
 
 LC_MESSAGES=C
 export LC_MESSAGES
+if !HWLOC_HAVE_MSVC
 ldflags += -Xlinker --output-def -Xlinker .libs/libhwloc.def
+endif
 
 if HWLOC_HAVE_MS_LIB
 dolib$(EXEEXT): dolib.c

bgoglin avatar Oct 23 '21 13:10 bgoglin

Possible workaround that I can't test until I have autoconf working with MSVC:

  • Run the batch setting up vsvars
  • open a msys bash
  • make sure /usr/share/automake-1.16 (or newer version) is on path (should contain some wrappers like ar-lib and compile)
  • setup like https://github.com/microsoft/vcpkg/blob/a875d756749fd441305b458523df671e8f2e6cae/scripts/cmake/vcpkg_configure_make.cmake#L360-L371 (the whole autoconf setup of vcpkg is in here) meaning setting e.g. CC/CXX='compile cl' and AR='ar-lib lib' (You might not need the wrappers). If you need RC/WINDRES you can copy over the wrapper used by vcpkg
  • variables like --build/--host are simply <arch>-pc-mingw32

Neumann-A avatar Oct 27 '21 08:10 Neumann-A