Cygwin: building libraries, fopen

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
goumba
Posts: 7
Joined: Thu Nov 20, 2008 8:59 am

Cygwin: building libraries, fopen

Post by goumba »

Hi guys, I know there was another topic on this, but the solution didn't help. I have successfully built the toolchain and libraries on Debian and Ubuntu, but I can't get the libraries to fully build under cygwin:

Code: Select all

configure:2815: psp-gcc --version >&5
psp-gcc (GCC) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2826: $? = 0
configure:2815: psp-gcc -v >&5
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-l
anguages=c,c++ --with-newlib --with-gmp --with-mpfr --enable-cxx-flags=-G0
Thread model: single
gcc version 4.3.2 (GCC)
configure:2826: $? = 0
configure:2815: psp-gcc -V >&5
psp-gcc: '-V' option must have argument
configure:2826: $? = 1
configure:2815: psp-gcc -qversion >&5
psp-gcc: unrecognized option '-qversion'
psp-gcc: no input files
configure:2826: $? = 1
configure:2848: checking for C compiler default output file name
configure:2870: psp-gcc   -L/usr/local/pspdev/lib -L/usr/local/pspdev/psp/lib -L
/usr/local/pspdev/psp/sdk/lib  -lpsplibc -lpspuser conftest.c  >&5
/cygdrive/c/DOCUME~1/Anthony/LOCALS~1/Temp/cc2SPKY5.o: In function `main':
conftest.c:(.text+0x20): undefined reference to `fopen'
conftest.c:(.text+0x48): undefined reference to `fclose'
collect2: ld returned 1 exit status
configure:2874: $? = 1
configure:2911: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main &#40;&#41;
| &#123;
| FILE *f = fopen &#40;"conftest.out", "w"&#41;;
|  return ferror &#40;f&#41; || fclose &#40;f&#41; != 0;
|
|   ;
|   return 0;
| &#125;
configure&#58;2917&#58; error&#58; in `/home/Anthony/src/psplibraries/build/freetype/builds/unix'&#58;
configure&#58;2921&#58; error&#58; C compiler cannot create executables
See `config.log' for more details.
Looking further:

Now, in the other thread it was suggested the toolchain did not build properly. I have removed cygwin, and the toolchain, and reinstalled and rebuilt, and always get this error. I am pretty sure that the toolchain had built correctly. Also the library holds the symbol:

Code: Select all

Anthony@deathstar /usr/local/pspdev
$ find . -name "*.a" | xargs grep fopen
Binary file ./i686-pc-cygwin/psp/lib/libbfd.a matches
Binary file ./lib/libiberty.a matches
Binary file ./lib/libpsp-sim.a matches
Binary file ./psp/lib/libbz2.a matches
Binary file ./psp/lib/libc.a matches***** &#40;emphasis mine&#41;
Binary file ./psp/lib/libg.a matches
Binary file ./psp/lib/libiberty.a matches
Binary file ./psp/lib/libstdc++.a matches
Binary file ./psp/lib/libsupc++.a matches
Binary file ./psp/lib/libz.a matches
Binary file ./psp/sdk/lib/libpsplibc.a matches
Binary file ./psp/sdk/lib/libpspprof.a matches
Any ideas? TIA.[/code]
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Code: Select all

psp-gcc   -L/usr/local/pspdev/lib -L/usr/local/pspdev/psp/lib -L
/usr/local/pspdev/psp/sdk/lib  -lpsplibc -lpspuser conftest.c  >&5 
Where is it getting that commandline from? Did you specify LDFLAGS yourself when compiling? Nowhere in the psplibraries script, nor in freetype, does it contain the string "psplibc". It should be using just "-lc" there.
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

psp-gcc ?
User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post by jbit »

I guess this want to be on the PSP forums....
goumba
Posts: 7
Joined: Thu Nov 20, 2008 8:59 am

Post by goumba »

Hey, sorry.

Yeah its libc. I just tried psplibc to se if I'd get any further (and yes, I know plain libc is preferred). Also I added -L/usr/local/pspdev/psp/lib just to cover all bases (although if it couldn't find the lib that would be the error I would get).
goumba
Posts: 7
Joined: Thu Nov 20, 2008 8:59 am

Post by goumba »

I also wanted to add that unlike in similar threads, I can not compile a program separately. In other words if I try to make a simple program outside of 'configure' it still fails with the same errors.

I am very familiar with Linux and never have this problem, but need Cygwin as I don't have access to Linux at work.
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

google "cygwin error: C compiler cannot create executables", then search your system for other instances of cygwin1.dll outside the cygwin install directory (such as the most common abuse of this dll which is found in /windows/system)

Once that is done, consider using heimdall's pre-built-and-windows-ized toolchain (link) instead just in case that work PC relies on the software that installed the extraneous/mismatched cygwin dll files.
goumba
Posts: 7
Joined: Thu Nov 20, 2008 8:59 am

Post by goumba »

Thanks, but the problem isn't "C Compiler cannot create executables" because the answer's right in config.log.

When I first installed cygwin, I got an error about mismatched cygwin-1.dlls. I promptly deleted every one but in the Cygwin dir and verified the version, so that's not the problem.

The computers at work really don't have much but McAfee and Novell software installed so I didn't think of cygwin-1 on those computers. You may have a point there, thanks.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

I already answered the question -- that error is because you edited the script and changed -lc to -lpsplibc or whatever. If you're still getting an error with an unmodified psplibraries script, post that config.log here and we'll see what we can do.
Post Reply