Open hulbs9nw opened 5 years ago
Would be interesting what your compiler flags are, CFLAGS/CXXFLAGS/GPPFLAGS. /usr/include/time.h knows about the three argument ctime_r but only when specific defines are set.
@hulbs9nw Looking at https://docs.oracle.com/cd/E36784_01/html/E36874/ctime-r-3c.html and it says the ctime_r
protype is the following:
char *ctime_r(const time_t *clock, char *buf, int buflen);
but your message is saying it is
/usr/include/time.h:265:14: note: declared here
extern char *ctime_r(const time_t *, char *);
^~~~~~~
Looking at https://github.com/openzfs/openzfs/blob/master/usr/src/lib/libc/port/gen/ctime_r.c shows this:
/*
* POSIX.1c Draft-6 version of the function ctime_r.
* It was implemented by Solaris 2.3.
*/
char *
ctime_r(const time_t *t, char *buffer, int buflen)
[...]
/*
* POSIX.1c standard version of the function ctime_r.
* User gets it via static ctime_r from the header file.
*/
char *
__posix_ctime_r(const time_t *t, char *buffer)
{
further https://bugs.freedesktop.org/show_bug.cgi?id=15463 has some discussion too. It looks like Solaris is in POSIX compatibility mode for ctime_r
so it is only taking two arguments.
The fix will be something like changing
#define os_ctime_r(x, y, z) ctime_r((x), (y), (z))
to
#define os_ctime_r(x, y, z) ctime_r((x), (y))
but there is a question as to why hasn't this appeared before? I admit these days I can only get hold of things like Illumos so maybe people aren't running fio on Solaris any more...
After ./configure I removed from Makefile CFLAGS the '-std=gnu99' string and compile is successful. Platform: Solaris 11.3 X86 gcc 4.9.4 (from sfe.opencsw.org) CFLAGS="-xO4 -xspace -m32 -xarch=pentium_pro -i -mr -xregs=no%frameptr" CXXFLAGS="-xO4 -xspace -m32 -xarch=pentium_pro -i -mr -xregs=no%frameptr" Result:
file fio .fio: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked, interpreter /usr/lib/ld.so.1, not stripped ./fio No job(s) defined fio-3.12 ./fio [options] [job options] <job file(s)> [...]
Thanks for the responses,
I tried removing -std=gnu99 from the Makefile but the compilation still fails with the same error.
With regards seeing the compiler flags, is this enough?
DEBUGFLAGS = -DFIO_INC_DEBUG CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS) OPTFLAGS= -g -ffast-math CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR) LIBS += -lm $(EXTLIBS) PROGS = fio SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio tools/fiologparser.py tools/hist/fiologparser_hist.py tools/fio_jsonplus_clat2csv)
ifndef CONFIG_FIO_NO_OPT CFLAGS += -O3 -D_POSIX_PTHREAD_SEMANTICS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 endif ifdef CONFIG_BUILD_NATIVE CFLAGS += -march=native endif
ifdef CONFIG_GFIO PROGS += gfio endif
I still see CFLAGS = -std=gnu99 in your copy of the Makefile. ./configure puts it into Makefile, again and again. Is this your steps when compiling? ./configure vim Makefile # remove all occurences of "-std=gnu99", write file gmake V=2
Sorry I sent you the wrong copy/paste. Same outcome:
gcc -o stat.o -Wwrite-strings -Wall -Wdeclaration-after-statement -g -ffast-math -D_GNU_SOURCE -include config-host.h -D_REENTRANT -I. -I. -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DBITS_PER_LONG=64 -DFIO_VERSION='"fio-3.12"' -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL -DFIO_INC_DEBUG -DEXTENSIONS -c stat.c In file included from os/os.h:46:0, from thread_options.h:5, from fio.h:18, from stat.c:7: stat.c: In function 'show_thread_status_normal': os/os-solaris.h:46:33: error: too many arguments to function 'ctime_r'
^
stat.c:793:2: note: in expansion of macro 'os_ctime_r'
os_ctime_r((const time_t ) &time_p, time_buf, sizeof(time_buf));
^~~~~~
In file included from /usr/include/sys/time.h:448:0,
from /usr/include/sys/select.h:27,
from /usr/include/sys/types.h:665,
from /usr/include/string.h:15,
from stat.c:2:
/usr/include/time.h:265:14: note: declared here
extern char ctime_r(const time_t , char );
^~~
In file included from os/os.h:46:0,
from thread_options.h:5,
from fio.h:18,
from stat.c:7:
stat.c: In function '__show_run_stats':
os/os-solaris.h:46:33: error: too many arguments to function 'ctime_r'
^
stat.c:1910:3: note: in expansion of macro 'os_ctime_r'
os_ctime_r(&tv_sec, time_buf, sizeof(time_buf));
^~~~~~
In file included from /usr/include/sys/time.h:448:0,
from /usr/include/sys/select.h:27,
from /usr/include/sys/types.h:665,
from /usr/include/string.h:15,
from stat.c:2:
/usr/include/time.h:265:14: note: declared here
extern char ctime_r(const time_t , char *);
^~~
gmake: *** [Makefile:359: stat.o] Error 1
@hulbs9nw can you re-checkout your repo to (making it pristine), edit os/os-solaris.h
and change
#define os_ctime_r(x, y, z) ctime_r((x), (y), (z))
to
#define os_ctime_r(x, y, z) ctime_r((x), (y))
then in the root folder run
gmake clean
gmake
And tell us where you get to?
It's compiled successfully
fio: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped
I've not tried running any jobs yet, will try that next.
Sitsofe, probably add a configure test for this.
@axboe good point.
I would more prefer removing the enforced setting -std=gnu99 from Makefile:
grep gnu99 * Makefile:CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR) This looks like enforcing old standards. And this is the root why compiling on Solaris fails.
Solaris can use both, the two and three argument call to crime_r and has an #ifdef in /usr/include/time.h https://github.com/illumos/illumos-gate/usr/src/head/time.h Lines 204...285
The headers in Solaris 2.3 through 11.3 follow an early draft of the POSIX Threads standard by default, which had 3 arguments to ctime_r().
The headers in Solaris 11.4 and later default to the final version of the POSIX Threads standard, which has only 2 arguments to ctime_r().
To get the standard POSIX version on any release,#define _POSIX_PTHREAD_SEMANTICS
.
To get the old draft version on Solaris 11.4, #define __USE_DRAFT6_PROTOTYPES__
.
This is documented in the Standard Compilation Environment section of What's New in Solaris 11.4.
@alanc - thank you for explaining this!
@jperkin I've spotted you fixing up fio builds for Illumos elsewhere... Would it be possible for you to test what happens if _POSIX_PTHREAD_SEMANTICS
is defined in https://github.com/axboe/fio/blob/84106576cefbbd9f5dfa5ee33b245f77938d0269/configure#L312 and the lines defining a three parameter ctime_r
are removed from https://github.com/axboe/fio/blob/84106576cefbbd9f5dfa5ee33b245f77938d0269/os/os-solaris.h#L46-L47 ?
I'm trying to compile fio-master on Solaris 11.4 and it fails with an error - too many arguments to function 'ctime_r'. See configure and gmake output below:
Any idea what the issue might be?