Bug 176 - torque-4.0.0: HWLOC_CFLAGS and HWLOC_LIBS ignored
: torque-4.0.0: HWLOC_CFLAGS and HWLOC_LIBS ignored
Status: RESOLVED FIXED
Product: TORQUE
libtorque
: 4.0.*
: PC Linux
: P5 major
Assigned To: David Beer
:
:
:
  Show dependency treegraph
 
Reported: 2012-04-23 15:52 MDT by Martin Siegert
Modified: 2012-05-30 17:09 MDT (History)
4 users (show)

See Also:


Attachments
patch to include HWLOC env. variables in Libifl Makefile (855 bytes, patch)
2012-04-23 15:52 MDT, Martin Siegert
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description Martin Siegert 2012-04-23 15:52:05 MDT
Created an attachment (id=103) [details]
patch to include HWLOC env. variables in Libifl Makefile

When configuring torque-4.0.0 with HWLOC_CFLAGS and HWLOC_LIBS set the
subsequent make fails in Libifl because those environment variables are not
used in the Makefile:

gcc -DHAVE_CONFIG_H -I. -I../../../src/include  -I../../../src/include
-DPBS_DEFAULT_FILE=\"/var/spool/torque/server_name\"
-DPBS_SERVER_HOME=\"/var/spool/torque\"  -g -DGEOMETRY_REQUESTS
-DALWAYS_USE_CPUSETS -DNUMA_SUPPORT -MT tcp_dis.o -MD -MP -MF .deps/tcp_dis.Tpo
-c -o tcp_dis.o tcp_dis.c
In file included from ../Libutils/u_lock_ctl.h:5,
                 from tcp_dis.c:101:
../../../src/include/pbs_nodes.h:98:21: error: hwloc.h: No such file or
directory
In file included from ../Libutils/u_lock_ctl.h:5,
                 from tcp_dis.c:101:
../../../src/include/pbs_nodes.h:225: error: expected specifier-qualifier-list
before ‘hwloc_bitmap_t’
make[4]: *** [tcp_dis.o] Error 1
make[4]: Leaving directory `/usr/local/src/torque-4.0.0/src/lib/Libifl'

The attached patch works for me.

- Martin
Comment 1 David Beer 2012-05-03 13:16:50 MDT
Martin,

This patch patches Makefile.in files, which are not version controlled. How did
you define these variables?
Comment 2 rhys.hill 2012-05-03 18:03:51 MDT
(In reply to comment #1)
> Martin,
> 
> This patch patches Makefile.in files, which are not version controlled. How did
> you define these variables?

I wonder if the real bug is that this:

src/lib/Libifl/Makefile.am:
CPPFLAGS = -DPBS_DEFAULT_FILE=\"$(PBS_DEFAULT_FILE)\"
-DPBS_SERVER_HOME=\"$(PBS_SERVER_HOME)\"

should be this:
AM_CPPFLAGS += -DPBS_DEFAULT_FILE=\"$(PBS_DEFAULT_FILE)\"
-DPBS_SERVER_HOME=\"$(PBS_SERVER_HOME)\"

which matches the other Makefile templates. Just setting the CPPFLAGS equal
would surely drop any existing settings?
Comment 3 Martin Siegert 2012-05-03 22:56:02 MDT
When configure does not find the hwloc.pc file it prints:

No package 'hwloc' found

Perhaps you should add the directory containing 'hwloc.pc'
to the PKG_CONFIG_PATH environment variable.

Alternatively, you may set the environment variables
HWLOC_CFLAGS and HWLOC_LIBS before running configure.

Example:
export HWLOC_CFLAGS='-I/usr/local/hwloc-1.1/include'
export HWLOC_LIBS='-L/usr/local/hwloc-1.1/lib -lhwloc'

Alas, setting HWLOC_CFLAGS and HWLOC_LIBS has absolutely no effect
since these variables are not referenced in the Makefile.

- Martin
Comment 4 rhys.hill 2012-05-03 23:10:54 MDT
(In reply to comment #3)
> When configure does not find the hwloc.pc file it prints:
> 
> No package 'hwloc' found
> 
> Perhaps you should add the directory containing 'hwloc.pc'
> to the PKG_CONFIG_PATH environment variable.
> 
> Alternatively, you may set the environment variables
> HWLOC_CFLAGS and HWLOC_LIBS before running configure.
> 
> Example:
> export HWLOC_CFLAGS='-I/usr/local/hwloc-1.1/include'
> export HWLOC_LIBS='-L/usr/local/hwloc-1.1/lib -lhwloc'
> 
> Alas, setting HWLOC_CFLAGS and HWLOC_LIBS has absolutely no effect
> since these variables are not referenced in the Makefile.
> 
> - Martin

Hi Martin,

I found the same and have bug180 on this which includes a temporary solution,
and there's a proper solution in bug 179. If you put:

PKG_PROG_PKG_CONFIG

right after LT_INIT in configure.ac, and rerun autogen.sh, the problem should
go away.

Cheers,

Rhys
Comment 5 Martin Siegert 2012-05-22 18:46:14 MDT
This still is not quite right with torque-4.0.2. Let's say that hwloc is
installed in /usr/local, i.e., include files in /usr/local/include and
libraries in /usr/local/lib64. Both /usr/local/lib64 and  /usr/local/include
are searched by the compiler by default, i.e., -I and -L flags are unnecessary.
I set HWLOC_LIBS="-lhwloc" and run configure:
...
checking for HWLOC... no
configure: error: cpuset support requires the hwloc package

No package 'hwloc' found

Perhaps you should add the directory containing 'hwloc.pc'
to the PKG_CONFIG_PATH environment variable.

Alternatively, you may set the environment variables
HWLOC_CFLAGS and HWLOC_LIBS before running configure.

Example:
export HWLOC_CFLAGS='-I/usr/local/hwloc-1.1/include'
export HWLOC_LIBS='-L/usr/local/hwloc-1.1/lib -lhwloc'

The problem is that HWLOC_CFLAGS is empty and in that case configure checks for
pkg-config which fails in my case; configure does not consider the case that
the code would compile without pkg-config and without any additional CFLAGS.
Comment 6 Craig West 2012-05-22 19:21:26 MDT
Is there some reason we can't have a --with-hwloc option instead of passing
environment variables? That is already done for tcl/tk.

Using a similar method to tcl/tk it could be --with-hwloc=/usr/local/hwloc (if
that is where you put it). With options to override --with-hwloclib and
--with-hwlocinclude if necessary.

I'm not sure why the environment variables are being used at the moment. Is
there a reason for that? What does it enable that configure options don't. 
Building RPMs would also be simpler with configure options.

- Craig.
Comment 7 David Beer 2012-05-23 10:20:39 MDT
These configure options will be added before 4.0.3. We may also support
environment variables if this isn't sufficient, but there is already a ticket
earmarked for 4.0.3 with the environment options.

(In reply to comment #6)
> Is there some reason we can't have a --with-hwloc option instead of passing
> environment variables? That is already done for tcl/tk.
> 
> Using a similar method to tcl/tk it could be --with-hwloc=/usr/local/hwloc (if
> that is where you put it). With options to override --with-hwloclib and
> --with-hwlocinclude if necessary.
> 
> I'm not sure why the environment variables are being used at the moment. Is
> there a reason for that? What does it enable that configure options don't. 
> Building RPMs would also be simpler with configure options.
> 
> - Craig.
Comment 8 David Beer 2012-05-30 17:09:37 MDT
Fixed in 4.0.3