Discussion:
DLD-FUNCTIONS/nprocs.cc:29:25: error: sys/sysinfo.h: No such file or directory
(too old to reply)
Ben Abbott
2011-03-17 01:16:19 UTC
Permalink
After the changset below ...

http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac

... I encounter an error ...

libtool: compile: g++-4.2 -DHAVE_CONFIG_H -I. -I.. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I../libgnu -I../libgnu -I../libcruft/misc -I../liboctave -I../liboctave -I. -I. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -DHAVE_CONFIG_H -mieee-fp -I/sw/include -I/sw/include/freetype2 -I/sw/include -I/usr/X11/include -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -D_THREAD_SAFE -pthread -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -MT DLD-FUNCTIONS/nprocs.lo -MD -MP -MF DLD-FUNCTIONS/.deps/nprocs.Tpo -c DLD-FUNCTIONS/nprocs.c
c -fno-common -DPIC -o DLD-FUNCTIONS/.libs/nprocs.o
DLD-FUNCTIONS/nprocs.cc:29:25: error: sys/sysinfo.h: No such file or directory
DLD-FUNCTIONS/nprocs.cc: In function 'octave_value_list Fnprocs(const octave_value_list&, int)':
DLD-FUNCTIONS/nprocs.cc:48: error: 'get_nprocs' was not declared in this scope
DLD-FUNCTIONS/nprocs.cc: In function 'octave_value_list Fnprocs_conf(const octave_value_list&, int)':
DLD-FUNCTIONS/nprocs.cc:72: error: 'get_nprocs_conf' was not declared in this scope
make[3]: *** [DLD-FUNCTIONS/nprocs.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

There is no sysinfo.h for MacOS. I can help determine what the MacOS equivalent is, but need someone to give me some hints.

Ben
Rik
2011-03-17 02:19:44 UTC
Permalink
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
libtool: compile: g++-4.2 -DHAVE_CONFIG_H -I. -I.. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I../libgnu -I../libgnu -I../libcruft/misc -I../liboctave -I../liboctave -I. -I. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -DHAVE_CONFIG_H -mieee-fp -I/sw/include -I/sw/include/freetype2 -I/sw/include -I/usr/X11/include -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -D_THREAD_SAFE -pthread -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -MT DLD-FUNCTIONS/nprocs.lo -MD -MP -MF DLD-FUNCTIONS/.deps/nprocs.Tpo -c DLD-FUNCTIONS/nprocs
.cc -fno-common -DPIC -o DLD-FUNCTIONS/.libs/nprocs.o
Post by Ben Abbott
DLD-FUNCTIONS/nprocs.cc:29:25: error: sys/sysinfo.h: No such file or directory
DLD-FUNCTIONS/nprocs.cc:48: error: 'get_nprocs' was not declared in this scope
DLD-FUNCTIONS/nprocs.cc:72: error: 'get_nprocs_conf' was not declared in this scope
make[3]: *** [DLD-FUNCTIONS/nprocs.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
There is no sysinfo.h for MacOS. I can help determine what the MacOS equivalent is, but need someone to give me some hints.
Ben
3/16/11

Ben,

On a Linux system the file is at /usr/include/sys/sysinfo.h.
Unfortunately, it seems to be very Linux-specific. According to 'man
sysinfo' I get

NAME
sysinfo - returns information on overall system statistics

SYNOPSIS
#include <sys/sysinfo.h>

int sysinfo(struct sysinfo *info);

...

CONFORMING TO
This function is Linux-specific, and should not be used in programs
intended to be portable.


This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable. The documentation from
gnulib is here:
http://www.gnu.org/s/hello/manual/gnulib/get_005fnprocs.html. I don't
really understand it. It might be saying that it doesn't provide portable
implementations for MacOS and a host of other platforms. If this is the
case, I'm not sure why it needs to be in gnulib. We can revert the change
if gnulib does not in fact offer any portable versions for non-Linux platforms.

--Rik
Kai Habel
2011-03-17 12:22:25 UTC
Permalink
Post by Rik
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
libtool: compile: g++-4.2 -DHAVE_CONFIG_H -I. -I.. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I../libgnu -I../libgnu -I../libcruft/misc -I../liboctave -I../liboctave -I. -I. -D__LISTS__ -I/sw/lib/flex/include -I/sw/include -m32 -I/sw/include/freetype2 -I/sw/include/qhull -I/usr/include -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -DHAVE_CONFIG_H -mieee-fp -I/sw/include -I/sw/include/freetype2 -I/sw/include -I/usr/X11/include -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -D_THREAD_SAFE -pthread -I/sw/include -m32 -O1 -g -D_THREAD_SAFE -MT DLD-FUNCTIONS/nprocs.lo -MD -MP -MF DLD-FUNCTIONS/.deps/nprocs.Tpo -c DLD-FUNCTIONS/nproc
s.cc -fno-common -DPIC -o DLD-FUNCTIONS/.libs/nprocs.o
Post by Rik
Post by Ben Abbott
DLD-FUNCTIONS/nprocs.cc:29:25: error: sys/sysinfo.h: No such file or directory
DLD-FUNCTIONS/nprocs.cc:48: error: 'get_nprocs' was not declared in this scope
DLD-FUNCTIONS/nprocs.cc:72: error: 'get_nprocs_conf' was not declared in this scope
make[3]: *** [DLD-FUNCTIONS/nprocs.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
There is no sysinfo.h for MacOS. I can help determine what the MacOS equivalent is, but need someone to give me some hints.
Ben
3/16/11
Ben,
On a Linux system the file is at /usr/include/sys/sysinfo.h.
Unfortunately, it seems to be very Linux-specific. According to 'man
sysinfo' I get
NAME
sysinfo - returns information on overall system statistics
SYNOPSIS
#include<sys/sysinfo.h>
int sysinfo(struct sysinfo *info);
...
CONFORMING TO
This function is Linux-specific, and should not be used in programs
intended to be portable.
This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable. The documentation from
http://www.gnu.org/s/hello/manual/gnulib/get_005fnprocs.html. I don't
really understand it. It might be saying that it doesn't provide portable
implementations for MacOS and a host of other platforms. If this is the
case, I'm not sure why it needs to be in gnulib. We can revert the change
if gnulib does not in fact offer any portable versions for non-Linux platforms.
--Rik
I just wanted to add that on MinGW the current tip does also not
compile, due to the same error. So we can either revert this change or
compile this function conditionally when sys/sysinfo.h is available.

Kai
Iain Murray
2011-03-17 12:25:01 UTC
Permalink
Post by Rik
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
...
Post by Rik
This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable.
I'm not familiar with this either, but I infer that we should be using the gnulib nproc module.
I assume there is some problem with that?
No, I just messed up. Sorry. I had misread the gnulib manual and thought
that it magically provided drop-in replacements of nprocs and
nprocs_conf. In fact, as I think Ben already knew, its nproc module
provides similar functionality through its function called
"num_processors".

I have updated nprocs.cc. It no longer provides `nprocs' and
`nprocs_conf', as we can't actually call native system routines of these
names across different platforms. Instead it provides `nproc', which
like the newish coreutils program of the same name, uses gnulib's
`num_processors' function. The new function takes an optional argument
to access the functionality available in the underlying gnulib routine.

An hg changeset is attached to this email. I don't know if that makes it
through the mailing list, so I'll attach it to the patch queue item at:
http://savannah.gnu.org/patch/index.php?7504
as well.

If Ben could see if this works in Mac OS that would be great. I only
have access to GNU/Linux here.

Iain.
Ben Abbott
2011-03-17 18:32:42 UTC
Permalink
Post by Iain Murray
Post by Rik
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
...
Post by Rik
This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable.
I'm not familiar with this either, but I infer that we should be using the gnulib nproc module.
I assume there is some problem with that?
No, I just messed up. Sorry. I had misread the gnulib manual and thought
that it magically provided drop-in replacements of nprocs and
nprocs_conf. In fact, as I think Ben already knew, its nproc module
provides similar functionality through its function called
"num_processors".
I have updated nprocs.cc. It no longer provides `nprocs' and
`nprocs_conf', as we can't actually call native system routines of these
names across different platforms. Instead it provides `nproc', which
like the newish coreutils program of the same name, uses gnulib's
`num_processors' function. The new function takes an optional argument
to access the functionality available in the underlying gnulib routine.
An hg changeset is attached to this email. I don't know if that makes it
http://savannah.gnu.org/patch/index.php?7504
as well.
If Ben could see if this works in Mac OS that would be great. I only
have access to GNU/Linux here.
Iain.
<nproc_gnulib.diff>
Works for me!

octave:1> nproc
ans = 4

Thanks,
Ben
Rik
2011-03-17 21:08:35 UTC
Permalink
Post by Ben Abbott
Post by Iain Murray
Post by Rik
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
...
Post by Rik
This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable.
I'm not familiar with this either, but I infer that we should be using the gnulib nproc module.
I assume there is some problem with that?
No, I just messed up. Sorry. I had misread the gnulib manual and thought
that it magically provided drop-in replacements of nprocs and
nprocs_conf. In fact, as I think Ben already knew, its nproc module
provides similar functionality through its function called
"num_processors".
I have updated nprocs.cc. It no longer provides `nprocs' and
`nprocs_conf', as we can't actually call native system routines of these
names across different platforms. Instead it provides `nproc', which
like the newish coreutils program of the same name, uses gnulib's
`num_processors' function. The new function takes an optional argument
to access the functionality available in the underlying gnulib routine.
An hg changeset is attached to this email. I don't know if that makes it
http://savannah.gnu.org/patch/index.php?7504
as well.
If Ben could see if this works in Mac OS that would be great. I only
have access to GNU/Linux here.
Iain.
<nproc_gnulib.diff>
Works for me!
3/17/11

I made a few minor mods and checked in the changeset. Hopefully it will
also work on mingw...

--Rik
Kai Habel
2011-03-19 17:12:40 UTC
Permalink
Post by Rik
Post by Ben Abbott
Post by Iain Murray
Post by Rik
Post by Ben Abbott
After the changset below ...
http://hg.savannah.gnu.org/hgweb/octave/rev/a1b2da4967ac
... I encounter an error ...
...
Post by Rik
This is sort of a drag as the whole point was to have access to the
underlying gnulib module which should be portable.
I'm not familiar with this either, but I infer that we should be using the gnulib nproc module.
I assume there is some problem with that?
No, I just messed up. Sorry. I had misread the gnulib manual and thought
that it magically provided drop-in replacements of nprocs and
nprocs_conf. In fact, as I think Ben already knew, its nproc module
provides similar functionality through its function called
"num_processors".
I have updated nprocs.cc. It no longer provides `nprocs' and
`nprocs_conf', as we can't actually call native system routines of these
names across different platforms. Instead it provides `nproc', which
like the newish coreutils program of the same name, uses gnulib's
`num_processors' function. The new function takes an optional argument
to access the functionality available in the underlying gnulib routine.
An hg changeset is attached to this email. I don't know if that makes it
http://savannah.gnu.org/patch/index.php?7504
as well.
If Ben could see if this works in Mac OS that would be great. I only
have access to GNU/Linux here.
Iain.
<nproc_gnulib.diff>
Works for me!
3/17/11
I made a few minor mods and checked in the changeset. Hopefully it will
also work on mingw...
--Rik
Yes, it compiles on MinGW again.
Post by Rik
octave.exe:1> nproc
ans = 2
And the answer is correct for my dual-core CPU.

Kai

Loading...