Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#47813 closed defect (fixed)

texlive-bin @2014_9 won't build on PPC Tiger (Mac OS X 10.4.11) because of re-write of C definition

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: drkp (Dan Ports)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: haspatch Cc: ryandesign (Ryan Carsten Schmidt), mojca (Mojca Miklavec)
Port: texlive-bin

Description

depbase=`echo psgs.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I.  -I./gui -DPS_GS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_tex_texlive-bin/texlive-bin/work/texlive-source-20140614-stripped/texk -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_tex_texlive-bin/texlive-bin/work/texlive-source-20140614-stripped/texk -I/opt/local/include/freetype2 -I/opt/local/include  -isystem/opt/local/include -Wimplicit -Wreturn-type -Wdeclaration-after-statement -Wno-unknown-pragmas -pipe -Os -arch ppc -MT psgs.o -MD -MP -MF $depbase.Tpo -c -o psgs.o psgs.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from psgs.c:40:
/usr/include/strings.h:75: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:75: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:76: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:76: error: expected declaration specifiers or '...' before '(' token
make[5]: *** [psgs.o] Error 1
make[5]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_tex_texlive-bin/texlive-bin/work/texlive-source-20140614-stripped/texk/xdvik'

/usr/include/strings.h has:

   58	#if !defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)
   59	
   60	#include <string.h>
   61	
   62	#else
   63	
   64	#include <_types.h>
   65	
   66	#ifndef	_SIZE_T
   67	#define	_SIZE_T
   68	typedef	__darwin_size_t	size_t;
   69	#endif
   70	
   71	int      bcmp(const void *, const void *, size_t);
   72	void     bcopy(const void *, void *, size_t);
   73	void     bzero(void *, size_t);
   74	int      ffs(int);
   75	char    *index(const char *, int);
   76	char    *rindex(const char *, int); 
   77	int      strcasecmp(const char *, const char *);
   78	int      strncasecmp(const char *, const char *, size_t);
   79	
   80	#endif  /* _POSIX_C_SOURCE */

which then gets pre-compiled as:

# 40 "psgs.c" 2
# 1 "/usr/include/strings.h" 1 3 4
# 71 "/usr/include/strings.h" 3 4
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, size_t);
int ffs(int);
char *(strchr((const char *),(int)));
char *(strrchr((const char *),(int)));
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
# 41 "psgs.c" 2

The missing WHITE SPACE after the KOMMA causes the error? This is introduced here:

# 163 "xdvi.h" 2
# 1 "/opt/local/include/X11/Xos.h" 1 3 4
# 34 "/opt/local/include/X11/Xos.h" 3 4
#define _XOS_H_ 
# 67 "/opt/local/include/X11/Xos.h" 3 4
#define index(s,c) (strchr((s),(c)))


#define rindex(s,c) (strrchr((s),(c)))
# 88 "/opt/local/include/X11/Xos.h" 3 4

Attachments (3)

main.log (1.7 MB) - added by ballapete (Peter "Pete" Dyballa) 10 years ago.
main.log
texlive-bin.diff (582 bytes) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
patch-texk-xdvik-psgs.c.diff (535 bytes) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.

Download all attachments as: .zip

Change History (13)

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

Attachment: main.log added

main.log

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

The pre-compiled output was produced this way:

/opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I.  -I./gui -DPS_GS -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_tex_texlive-bin/texlive-bin/work/texlive-source-20140614-stripped/texk -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_tex_texlive-bin/texlive-bin/work/texlive-source-20140614-stripped/texk -I/opt/local/include/freetype2 -I/opt/local/include  -isystem/opt/local/include -Wimplicit -Wreturn-type -Wdeclaration-after-statement -Wno-unknown-pragmas -pipe -Os -arch ppc -MT psgs.o -MD -MP -MF $depbase.Tpo -E -dD -H -o psgs.cpp psgs.c

comment:2 in reply to:  description ; Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to Peter_Dyballa@…:

/usr/include/strings.h:75: error: expected declaration specifiers or '...' before '(' token

I Googled this error message and found bug report (for another project and OS) which says that on some systems, strings.h is not self-contained, and it is necessary to #include <sys/types.h> first. Can you try making that change, wherever strings.h is #included? My Tiger machine is currently busy...

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

Cc Me!

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

My PowerBook G4 is currently running Leopard… Might take two days, or three…

comment:5 Changed 10 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:6 in reply to:  2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: dports@… removed
Owner: changed from macports-tickets@… to dports@…

Replying to ryandesign@…:

on some systems, strings.h is not self-contained, and it is necessary to #include <sys/types.h> first. Can you try making that change, wherever strings.h is #included?

I'm trying this now, but of course it will take a long time to build.

comment:7 in reply to:  description Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Replying to ryandesign@…:

Replying to ryandesign@…:

on some systems, strings.h is not self-contained, and it is necessary to #include <sys/types.h> first. Can you try making that change, wherever strings.h is #included?

I'm trying this now, but of course it will take a long time to build.

This didn't make any difference, but I think the attached patch does.

Replying to Peter_Dyballa@…:

/usr/include/strings.h:75: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:75: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:76: error: expected declaration specifiers or '...' before '(' token
/usr/include/strings.h:76: error: expected declaration specifiers or '...' before '(' token

My understanding of the problem is that strings.h is a collection of obsolete nonstandard functions.

/usr/include/strings.h has:

   75	char    *index(const char *, int);
   76	char    *rindex(const char *, int); 

These are two of the obsolete functions. The modern name of index is strchr and the modern name of rindex is strrchr.

which then gets pre-compiled as:

char *(strchr((const char *),(int)));
char *(strrchr((const char *),(int)));

Note that here, index has changed to strchr and rindex has changed to strrchr. Note also the added parentheses. It seems something has #defined the old names to the new names, leading to the strings.h system header becoming unusable. (The #define makes sense if you want to use the function but don't have a declaration for it, but makes no sense when applied to a function declaration.)

I believe the code responsible for doing this is in Xos.h. MacPorts' version of that file (in xorg-xproto) contains in part:

# include <string.h>
# if defined(__SCO__) || defined(__UNIXWARE__) || defined(__sun) || defined(__CYGWIN__) || defined(_AIX)
#  include <strings.h>
# else
#  ifndef index
#   define index(s,c) (strchr((s),(c)))
#  endif
#  ifndef rindex
#   define rindex(s,c) (strrchr((s),(c)))
#  endif
# endif

That looks like what we're seeing.

There's an older version of Xos.h on Tiger installed by its optional X11 package, but due to the order of the include paths I think the MacPorts version is the one that's being used.

I guess this means __SCO__, __UNIXWARE__, __sun, __CYGWIN__ and _AIX are all not defined (which makes sense since OS X is not any of those operating systems), and therefore it doesn't think we have strings.h (although we do—why doesn't it know that OS X has strings.h?). And the subsequent ifndef guards for index and rindex wouldn't match because index and rindex are never defined (using #define); rather, they're declared (as normal functions).

I would call it a misfeature that an X header tries to influence what string functions are available. That should be up to the string headers, not the X headers.

The simplest solution for us here is to #include <string.h> instead of strings.h because the file in question (psgs.c) doesn't actually use any of the obsolete nonstandard functions anymore; it used to, but the ChangeLog in that directory says it was fixed in 2013, but I guess they forgot to update the #include statement.

Before committing, let me try the patch on another Tiger system just to be sure (my build succeeded but it wasn't a clean build), and let me also verify that it still builds ok on a modern system like Yosemite. You're welcome to try the patch on your Tiger system too.

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: texlive-bin.diff added

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

comment:8 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: newclosed

comment:9 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Before Jeremy committed the fix for xorg-xproto, I verified that texlive-bin compiles fine with my patch on Yosemite x86_64 and Leopard ppc.

Although the build failure should now be resolved through Jeremy's patch, I still think the include in texlive-bin should be changed as I proposed. I filed a bug with the developers of xdvi: https://sourceforge.net/p/xdvi/bugs/395/

comment:10 in reply to:  9 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

I still think the include in texlive-bin should be changed as I proposed. I filed a bug with the developers of xdvi: https://sourceforge.net/p/xdvi/bugs/395/

They fixed it: http://xdvi.cvs.sourceforge.net/viewvc/xdvi/xdvik/texk/xdvik/psgs.c?r1=1.74&r2=1.75

Note: See TracTickets for help on using tickets.