Opened 5 years ago

Closed 4 years ago

#59809 closed defect (fixed)

libtasn1 @4.15.0 does not build on PPC Tiger, Mac OS X 10.4.11, because: 'for' loop initial declaration used outside C99 mode

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: tiger Cc: kencu (Ken)
Port: libtasn1

Description

make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0/src'
Making all in fuzz
make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0/fuzz'
  CC       corpus2array.o
corpus2array.c: In function 'main':
corpus2array.c:123: error: 'for' loop initial declaration used outside C99 mode
make[2]: *** [corpus2array.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0/fuzz'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libtasn1/libtasn1/work/libtasn1-4.15.0" && /usr/bin/make -w all 
Exit code: 2

This error sounds very strange to me. The C code is:

  100	int main(void)
  101	{
  102		struct fuzz_elem e;
  103	
  104		printf("const asn1_static_node tab[] = {\n");
  105	
  106		while (fread(&e, sizeof(e), 1, stdin) == 1) {
  107			e.name[sizeof(e.name) - 1] = 0;
  108			e.value[sizeof(e.value) - 1] = 0;
  109			if (strcmp(e.name, "NULL"))
  110				printf("  { \"%s\"", escape((unsigned char *) e.name));
  111			else
  112				printf("  { NULL");
  113	
  114			if (e.type) {
  115				int add = 0;
  116	
  117				// we leave the lowest 8 bit out
  118				if ((e.type & 0xFF) == 17) {
  119					printf(", ASN1_ETYPE_TIME");
  120					add = 1;
  121				}
  122	
==>  123				for (int i = 8; i < 32 ; i++) {   <==
  124					if ((e.type & (1U << i)) && typename[i - 8]) {
  125						printf(add ? "|%s" : ", %s", typename[i - 8]);
  126						add = 1;
  127					}
  128				}
  129	
  130				if (!add)
  131					printf(", %u", e.type);
  132			} else
  133				printf(", 0");
  134	
  135			if (strcmp(e.value, "NULL"))
  136				printf(", \"%s\" },\n", escape((unsigned char *) e.value));
  137			else
  138				printf(", NULL },");
  139		}
  140	
  141		printf("  { NULL, 0, NULL }\n");
  142		printf("};\n");
  143	
  144		return 0;
  145	}

Attachments (1)

main.log (25.1 KB) - added by ballapete (Peter "Pete" Dyballa) 5 years ago.
Main.log from PPC Tiger

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger

comment:1 Changed 5 years ago by jmroot (Joshua Root)

Cc: mps@… removed
Owner: set to Schamschula
Status: newassigned

The error makes perfect sense. You can't declare a variable in the initialisation clause of a for statement in C89. It most likely just needs -std=c99 (and upstream should add it if so).

comment:2 Changed 5 years ago by jmroot (Joshua Root)

If you build again with [fe581bbe7b50aa64fe3bf75a8da3c4fb70c8981e/macports-ports] then the log will show the actual compiler flags being used.

comment:3 Changed 5 years ago by kencu (Ken)

This works:

configure.cflags-append -std=c99
Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:4 in reply to:  3 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

This worked.

comment:5 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

PPC Leopard, Mac OS X 10.5.8 has the same for loop error. I'll try again with the additional CFLAG!

comment:6 in reply to:  5 Changed 5 years ago by ballapete (Peter "Pete" Dyballa)

Replying to ballapete:

PPC Leopard, Mac OS X 10.5.8, behaves the same as PPC Tiger, Mac OS X 10.4.11: it builds with this flag.

comment:8 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Meanwhile

  libtasn1 @4.16.0_0 (active) platform='darwin 9' archs='ppc' date='2020-02-06T18:08:55+0100'

is installed.

comment:9 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

Thanks for the info!

Note: See TracTickets for help on using tickets.