Compilation problem on Solaris 11 on flock use

Asked by Julien Gabel

Hello,

Trying to compile stress-ng on recent Solaris 11 system using gcc, I get this error message:

[...]
stress-dentry.c: In function ‘stress_dentry_misc’:
stress-dentry.c:180:8: warning: implicit declaration of function ‘flock’ [-Wimplicit-function-declaration]
  ret = flock(fd, LOCK_EX);
        ^
stress-dentry.c:180:18: error: ‘LOCK_EX’ undeclared (first use in this function)
  ret = flock(fd, LOCK_EX);
                  ^
stress-dentry.c:180:18: note: each undeclared identifier is reported only once for each function it appears in
stress-dentry.c:182:19: error: ‘LOCK_UN’ undeclared (first use in this function)
   ret = flock(fd, LOCK_UN);
                   ^
gmake[1]: *** [stress-dentry.o] Error 1
gmake[1]: Leaving directory `/tmp/stress-ng-0.09.34'
gmake: *** [all_config] Error 2

I think this post may be of help regarding this issue: https://www.perkin.org.uk/posts/solaris-portability-flock.html

Or did I made something wrong?

Thank you.

--
best regards,
Julien Gabel.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu stress-ng Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Solaris isn't supported here. You want a Solaris forum

Revision history for this message
Julien Gabel (julien.gabel) said :
#2

Hi,

The documentation says it is expected to run on Solaris. Hence, it have to be build first.
The provided README says:

[...]
To build on SunOS, one requires GCC and GNU make, build using:
        CC=gcc gmake clean
        CC=gcc gmake
[...]

And I did exactly that. But the fact is, the syscall flock i s not supported on Solarish systems.
A proper, and more portable, syscall for those systems seems to be fcntl (as explained by the proposed link in my initial message).

BTW, it is not a Solaris problem per-se, but the fact that a syscall is used where not available on all platform.
I found no check code for that in the test programs, nor no ifdef for managing particular cases (for other OSes for example).
Last, the fix/workaround is well to be changed in code of stress-ng itself, nothing on Solaris side I would say--especially since it is supposed to run on it.

I just think I would have to find another tool for our stress tests.

Anyway thank you answering me.

--
Best regards,
Julien Gabel.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

You are using Solaris. Solaris isn't supported here. There are many distribution agnostic forums which support lots of distributions. This is Ubuntu only.

Revision history for this message
Julien Gabel (julien.gabel) said :
#4

Hi,

OK, so, sorry for the noise.

BTW, the official page for stress-ng (http://kernel.ubuntu.com/~cking/stress-ng/) says that for bug report we have to go to this site:
"For bug reports, visit: Stress-ng at LaunchPad (https://launchpad.net/ubuntu/+source/stress-ng)"

So, can someone please kindly redirect me to a not Ubuntu-only site regarding strees-ng maybe? Thank you in advance.

--
Best regards,
Julien Gabel.

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

Maybe you could try contacting http://kernel.ubuntu.com/~cking/

Revision history for this message
Julien Gabel (julien.gabel) said :
#6

Hi,

OK, I will do that. Thank you for your answer.

--
Best regards,
Julien Gabel.

Revision history for this message
Colin Ian King (colin-king) said :
#7

I've pushed a fix to hopefully work around this for Solaris 11, please pull the fix and see if it helps.

http://kernel.ubuntu.com/git/cking/stress-ng.git/commit/?id=0791bc204d6bd5d2683c30c0c6cab1b429f4da9b

Colin

Revision history for this message
Julien Gabel (julien.gabel) said :
#8

Hi,

I tested with the "exclusion", and it now ends building the stress-ng binary. FYI, and FYI-only, here are some warnings I got (and which can be investigated later _if necessary_):

[...]
CC stress-fork.c
stress-fork.c: In function ‘stress_vfork’:
stress-fork.c:145:2: warning: ‘vfork’ is deprecated [-Wdeprecated-declarations]
  return stress_fork_fn(args, vfork, vfork_max);
  ^
In file included from stress-ng.h:46:0,
                 from stress-fork.c:25:
/usr/include/unistd.h:535:14: note: declared here
 extern pid_t vfork(void) __ATTR_DEPRECATED;
              ^
[...]
CC stress-open.c
grep: illegal option -- e
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
CC stress-personality.c
[...]

[...]
CC stress-vforkmany.c
stress-vforkmany.c: In function ‘stress_vforkmany’:
stress-vforkmany.c:134:5: warning: ‘vfork’ is deprecated [-Wdeprecated-declarations]
     pid = vfork();
     ^
In file included from stress-ng.h:46:0,
                 from stress-vforkmany.c:25:
/usr/include/unistd.h:535:14: note: declared here
 extern pid_t vfork(void) __ATTR_DEPRECATED;
              ^
[...]

Anyway, I now have a working stress-ng to test/play with. Thank you very much.

--
Best regards,
Julien Gabel.

Can you help with this problem?

Provide an answer of your own, or ask Julien Gabel for more information if necessary.

To post a message you must log in.