On Fri Nov 4 05:43:44 UTC 2016 Dennis Clarke dclarke at blastwave.org wrote:
>During a compile in the same way as I have always done I was surprised >to see : > >. >. >. >/opt/developerstudio12.5/bin/cc -mt >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001 -I../../../.. >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include >-I../../../../lib/dns/include >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/isc/include >-I../../../../lib/isc -I../../../../lib/isc/include >-I../../../../lib/isc/unix/include >-I../../../../lib/isc/pthreads/include >-I../../../../lib/isc/noatomic/include -D_REENTRANT -D_LARGEFILE_SOURCE >-D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS >-D_LARGEFILE64_SOURCE -DDIG_SIGCHASE=1 -D_XPG4_2 -D__EXTENSIONS__ -m64 >-errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff >-xmemalign=8s -xnolibmil -Xc -xcode=pic32 -xregs=no%appl -xlibmieee -mc >-g -xs -ftrap=%none -Qy -xbuiltin=%none -xdebugformat=dwarf -xunroll=1 >-I/usr/local/include -xtarget=ultraT2 -xcache=8/16/4:4096/64/16 >-I/usr/local/ssl/include -I/usr/local/ssl -D_TS_ERRNO >-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE >-I/usr/local/include/libxml2 -I/usr/local/include -I /usr/local/include >-KPIC -KPIC -c driver.c >"/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include/dns/rrl.h", > >line 90: warning: nonportable bit-field type >"/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include/dns/rrl.h", > >line 91: warning: nonportable bit-field type >"/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include/dns/rrl.h", > >line 115: warning: nonportable bit-field type >"/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include/dns/rrl.h", > >line 118: warning: nonportable bit-field type >ld -G -z text -o driver.so driver.o >gmake[4]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dlzexternal' >making all in >/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb >gmake[4]: Entering directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb' >making all in >/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb/driver >gmake[5]: Entering directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb/driver' >/opt/developerstudio12.5/bin/cc -mt >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001 -I../../../../.. >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/dns/include >-I../../../../../lib/dns/include >-I/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/lib/isc/include >-I../../../../../lib/isc -I../../../../../lib/isc/include >-I../../../../../lib/isc/unix/include >-I../../../../../lib/isc/pthreads/include >-I../../../../../lib/isc/noatomic/include -D_REENTRANT >-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO >-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -DDIG_SIGCHASE=1 >-D_XPG4_2 -D__EXTENSIONS__ -m64 -errfmt=error -erroff=%none >-errshort=full -xstrconst -xildoff -xmemalign=8s -xnolibmil -Xc >-xcode=pic32 -xregs=no%appl -xlibmieee -mc -g -xs -ftrap=%none -Qy >-xbuiltin=%none -xdebugformat=dwarf -xunroll=1 -I/usr/local/include >-xtarget=ultraT2 -xcache=8/16/4:4096/64/16 -I/usr/local/ssl/include >-I/usr/local/ssl -D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS >-D_LARGEFILE64_SOURCE -I/usr/local/include/libxml2 -I/usr/local/include >-I /usr/local/include -KPIC -KPIC -c db.c >"db.c", line 110: warning: statement not reached >"db.c", line 126: warning: statement not reached >"db.c", line 151: warning: statement not reached >"db.c", line 771: warning: argument mismatch >"db.c", line 771: error: syntax error before or at: ) >cc: acomp failed for db.c >gmake[5]: *** [db.o] Error 2 >gmake[5]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb/driver' >gmake[4]: *** [subdirs] Error 1 >gmake[4]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system/dyndb' >gmake[3]: *** [subdirs] Error 1 >gmake[3]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests/system' >gmake[2]: *** [subdirs] Error 1 >gmake[2]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin/tests' >gmake[1]: *** [subdirs] Error 1 >gmake[1]: Leaving directory >`/usr/local/build/bind-9.11.0-P1_SunOS5.10_sparcv9.001/bin' >gmake: *** [subdirs] Error 1 > > >This is a run of the mill compile with the latest bind release on >Solaris 10 with the Oracle Studio 12.5 compilers. > >Taking a glance at the trouble : > >$ cat -n ./bin/tests/system/dyndb/driver/db.c | head -780 | tail -20 > 761 REQUIRE(rdclass == dns_rdataclass_in); > 762 REQUIRE(argc == 0); > 763 REQUIRE(argv != NULL); > 764 REQUIRE(driverarg != NULL); /* pointer to driver >instance */ > 765 REQUIRE(dbp != NULL && *dbp == NULL); > 766 > 767 UNUSED(driverarg); /* no driver-specific configuration */ > 768 > 769 a_addr.s_addr = 0x0100007fU; > 770 > 771 CHECKED_MEM_GET_PTR(mctx, sampledb); > 772 ZERO_PTR(sampledb); > 773 > 774 isc_mem_attach(mctx, &sampledb->common.mctx); > 775 dns_name_init(&sampledb->common.origin, NULL); > 776 isc_ondestroy_init(&sampledb->common.ondest); > 777 > 778 sampledb->common.magic = DNS_DB_MAGIC; > 779 sampledb->common.impmagic = SAMPLEDB_MAGIC; > 780 > > >So nothing obvious however perhaps the argument mismatch is the issue. > >The CFLAGS above are set for strict C99 compliance : > >$ echo $CFLAGS >-m64 -errfmt=error -erroff=%none -errshort=full -xstrconst -xildoff >-xmemalign=8s -xnolibmil -Xc -xcode=pic32 -xregs=no%appl -xlibmieee -mc >-g -xs -ftrap=%none -Qy -xbuiltin=%none -xdebugformat=dwarf -xunroll=1 >-I/usr/local/include -I/usr/local/ssl/include -I/usr/local/ssl >-D_TS_ERRNO -D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE > > >Perhaps strict C99 compliance is the issue ? > >Dennis I encountered the same issue compiling BIND 9.11.2 using the Sun Forte 7 C Compiler on Solaris 9. Short answer: That compiler's macro expansion results in a syntax error each time log_error() is called with a single argument (instead of more than one argument). My workaround was to change those calls to have two arguments. -- Long answer: Here's one of the places it fails: making all in /var/local/src/bind-9.11.2/bin/tests/system/dyndb/driver cc -mt -I/var/local/src/bind-9.11.2 -I../../../../.. -I/var/local/src/bind-9.11.2/lib/dns/include -I../../../../../lib/dns/include -I/var/local/src/bind-9.11.2/lib/isc/include -I../../../../../lib/isc -I../../../../../lib/isc/include -I../../../../../lib/isc/unix/include -I../../../../../lib/isc/pthreads/include -I../../../../../lib/isc/noatomic/include -I/usr/local/include -D_REENTRANT -DOPENSSL -D_XPG4_2 -D__EXTENSIONS__ -L/usr/local/lib -fast -I/usr/local/include/libxml2 -I /usr/local/include -KPIC -KPIC -c db.c cc: Warning: -xarch=native has been explicitly specified, or implicitly specified by a macro option, -xarch=native on this architecture implies -xarch=v8plusb which generates code that does not run on pre UltraSPARC III processors "db.c", line 772: warning: argument mismatch "db.c", line 772: syntax error before or at: ) "db.c", line 818: cannot recover from previous errors cc: acomp failed for db.c *** Error code 2 make: Fatal error: Command failed for target `db.o' "db.c", line 772 is: CHECKED_MEM_GET_PTR(mctx, sampledb); CHECKED_MEM_GET_PTR is a macro defined in ./bin/tests/system/dyndb/driver/util.h as: #define CHECKED_MEM_GET_PTR(m, target_ptr) \ CHECKED_MEM_GET(m, target_ptr, sizeof(*(target_ptr))) CHECKED_MEM_GET is a macro defined in ./bin/tests/system/dyndb/driver/util.h as: #define CHECKED_MEM_GET(m, target_ptr, s) \ do { \ (target_ptr) = isc_mem_get((m), (s)); \ if ((target_ptr) == NULL) { \ result = ISC_R_NOMEMORY; \ log_error("Memory allocation failed"); \ goto cleanup; \ } \ } while (0) ISC_R_NOMEMORY is a macro defined in ./contrib/dlz/modules/include/dlz_minimal.h as: #define ISC_R_NOMEMORY 1 So the call to CHECKED_MEM_GET_PTR(mctx, sampledb); presumably expands to: CHECKED_MEM_GET(mctx, sampledb, sizeof(*(sampledb))); which in turn presumably expands to: do { \ (sampledb) = isc_mem_get((mctx), (sizeof(*(sampledb)))); \ if ((sampledb) == NULL) { \ result = 1; \ log_error("Memory allocation failed"); \ goto cleanup; \ } \ } while (0); And log_error is in turn a macro defined in ./bin/tests/system/dyndb/driver/log.h as: #define log_error(format, ...) \ log_write(ISC_LOG_ERROR, format, ##__VA_ARGS__) Compiling with -E to see the macro expansion shows: that db.c line 772 expanded to do { ( sampledb ) = isc__mem_get ( ( ( mctx ) ) , ( ( sizeof ( * ( sampledb ) ) ) ) , "db.c" , 772 ) ; if ( ( sampledb ) == 0 ) { result = 1 ; log_write ( ( - 4 ) , "Memory allocation failed" , ) ; goto cleanup ; } } while ( 0 ); Reformatting that to be more legible: do { ( sampledb ) = isc__mem_get ( ( ( mctx ) ) , ( ( sizeof ( * ( sampledb ) ) ) ) , "db.c" , 772 ) ; \ if ( ( sampledb ) == 0 ) { \ result = 1 ; \ log_write ( ( - 4 ) , "Memory allocation failed" , ) ; \ goto cleanup ; \ } \ } while ( 0 ); The problem is that the macro expansion emitted an extra comma after the string passed to log_write(). Comparing that to Sun Studio 9 Compiler (which does not exhibit the issue), where the macro expansion of db.c line 722 is OK: do { ( sampledb ) = isc__mem_get ( ( ( mctx ) ) , ( ( sizeof ( * ( sampledb ) ) ) ) , "db.c" , 772 ) ; if ( ( sampledb ) == 0 ) { result = 1 ; log_write ( ( - 4 ) , "Memory allocation failed" ) ; goto cleanup ; } } while ( 0 ); In Sun Forte C 7.0, the macro expansion of calling log_error() with a *single* argument log_error(STRING) results in macro expansion to: log_write( (- NUMBER ) , STRING , ) The trailing comma causes the compiler to report an syntax error. In other compilers where the problem doesn't happen, the same call to log_error instead macro expands to: log_write( (- NUMBER ) , STRING ) The trailing comma is not present, so the compiler is happy. To work around the issue on a Sun Forte C 7.0 system, I located all the calls that failed due to calling log_write() with a single argument log_write("foo") ...instead to have more than one argument, for example: log_write("%s", "foo") *** ./bin/tests/system/dyndb/driver/util.h 2018/01/17 23:01:11 1.1 --- ./bin/tests/system/dyndb/driver/util.h 2018/01/17 23:01:38 *************** *** 30,36 **** (target_ptr) = isc_mem_get((m), (s)); \ if ((target_ptr) == NULL) { \ result = ISC_R_NOMEMORY; \ ! log_error("Memory allocation failed"); \ goto cleanup; \ } \ } while (0) --- 30,36 ---- (target_ptr) = isc_mem_get((m), (s)); \ if ((target_ptr) == NULL) { \ result = ISC_R_NOMEMORY; \ ! log_error("%s", "Memory allocation failed"); \ goto cleanup; \ } \ } while (0) *************** *** 43,49 **** (target) = isc_mem_strdup((m), (source)); \ if ((target) == NULL) { \ result = ISC_R_NOMEMORY; \ ! log_error("Memory allocation failed"); \ goto cleanup; \ } \ } while (0) --- 43,49 ---- (target) = isc_mem_strdup((m), (source)); \ if ((target) == NULL) { \ result = ISC_R_NOMEMORY; \ ! log_error("%s", "Memory allocation failed"); \ goto cleanup; \ } \ } while (0) *** ./bin/tests/system/dyndb/driver/instance.c 2018/01/17 23:02:08 1.1 --- ./bin/tests/system/dyndb/driver/instance.c 2018/01/17 23:02:25 *************** *** 52,58 **** log_info("number of params: %d", i); if (argc != 2) { ! log_error("exactly two parameters " "(absolute zone names) are required"); result = ISC_R_FAILURE; goto cleanup; --- 52,58 ---- log_info("number of params: %d", i); if (argc != 2) { ! log_error("%s", "exactly two parameters " "(absolute zone names) are required"); result = ISC_R_FAILURE; goto cleanup; _______________________________________________ Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users