Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling on Cygwin64: print.c:66:14: error: conflicting types for ‘utoa’ #11

Open
mogria opened this issue Apr 13, 2015 · 0 comments
Labels

Comments

@mogria
Copy link

mogria commented Apr 13, 2015

I tried to compile es on cygwin (64bit) by using the tarball for the 0.9 release.
I configured the source (from an other build directory) and ran make:

[...]
gcc  -I. -I../es-0.9 -g -O2   -c -o prim-sys.o ../es-0.9/prim-sys.c
gcc  -I. -I../es-0.9 -g -O2   -c -o prim.o ../es-0.9/prim.c
gcc  -I. -I../es-0.9 -g -O2   -c -o print.o ../es-0.9/print.c
../es-0.9/print.c:66:14: error: conflicting types for ‘utoa’
 static char *utoa(unsigned long u, char *t, unsigned int radix, char *digit) {
              ^
In file included from /usr/include/sys/unistd.h:8:0,
                 from /usr/include/unistd.h:4,
                 from ../es-0.9/stdenv.h:24,
                 from ../es-0.9/es.h:4,
                 from ../es-0.9/print.c:3:
/usr/include/stdlib.h:184:8: note: previous declaration of ‘utoa’ was here
 char * _EXFUN(utoa,(unsigned, char *, int));
        ^
<builtin>: recipe for target 'print.o' failed
make: *** [print.o] Error 1
$ 

It seems that the function utoa defined in print.c clashes with a function of the same name defined in stdlib.h.

$ grep -r 'utoa' .                                                  /opt/es-0.9
./print.c:static char *utoa(unsigned long u, char *t, unsigned int radix, char *digit) {
./print.c:              t = utoa(u / radix, t, radix, digit);
./print.c:      len = utoa(u, number, radix, table[upper]) - number;

This function is only used two times. Let's just rename it?

$ sed -ri 's/utoa/another_utoa/g' **/**.c                           /opt/es-0.9
$ grep -r 'utoa' .                                                  /opt/es-0.9
./print.c:static char *another_utoa(unsigned long u, char *t, unsigned int radix, char *digit) {
./print.c:              t = another_utoa(u / radix, t, radix, digit);
./print.c:      len = another_utoa(u, number, radix, table[upper]) - number;

I could now compile the es from the source directory by using ./configure && make. (I needed to install the bison package)

memreflect added a commit to memreflect/es-shell that referenced this issue Apr 6, 2022
wryun#11 describes an issue when building on the Cygwin
platform; it defines its own 'utoa' function with a different signature.
It has been renamed to 'utostr'.
@jpco jpco added the bug label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants