This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot link ___assert, __impure_ptr with -mno-cygwin


On Tue, 29 Mar 2005 10:31:06 -0500, Williams, Gerald S (Jerry)
<gsw@agere.com> wrote:
> Matt Olson wrote:
> > I've narrowed my problems down to a relatively small test case:
> [...]
> > Makefile:
> [...]
> > LINKFLAGS = -g -L/lib/mingw -mwindows -mno-cygwin
> > LIBS      = -lmingw32
> >
> > foo: foo.o
> >         gcc $(LINKFLAGS) -o foo foo.o $(LIBS)
> [...]
> > Compiler output:
> > $ make
> > gcc -g -L. -L/home/matt/lib -L/lib/mingw -o foo foo.o -lmingw32
> > -mwindows -mno-cygwin
> 
> I don't quite know how you got that makefile to produce
> precisely that output. :-)
> 
> Regardless, try starting again after removing foo.o.
> My guess is that you have a version of foo.o compiled
> without -mno-cygwin.
> 
> If you rebuild everything, it should compile cleanly,

You're right. *blush*  I should have noticed that 'make' was only linking.

Unfortunately, while "compile .o files with -mno-cygwin" fixes my toy
example, it doesn't help the real code I'm trying to build:

$ make
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_bitmap.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_bitmap_io.c
omfg_bitmap_io.c: In function `read_png_rows':
omfg_bitmap_io.c:455: warning: initialization from incompatible pointer type
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_camera.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_err_check.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_event.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_init.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_geom.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_gl_state.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_log.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include
-I/usr/local/include/SDL -Dmain=SDL_main -I/usr/include/mingw -DWIN32
-Uunix -mno-cygwin -mwindows -c omfg_mesh.c
omfg_mesh.c: In function `omfg_alloc_mesh':
omfg_mesh.c:44: warning: implicit declaration of function `omfg_free'
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_texfont.c
omfg_texfont.c: In function `omfg_glprintf':
omfg_texfont.c:62: warning: implicit declaration of function `vsnprintf'
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_texture.c
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -c omfg_timer.c
ar cr libomfg.a omfg_bitmap.o omfg_bitmap_io.o omfg_camera.o
omfg_err_check.o omfg_event.o omfg_init.o omfg_geom.o omfg_gl_state.o
omfg_log.o omfg_mesh.o omfg_texfont.o omfg_texture.o omfg_timer.o
gcc -Wall -ansi -g -I/usr/include -I/home/matt/include -I/usr/local/include/SDL
-Dmain=SDL_main -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin
-mwindows -DOMFG_BUILD_TEST -c omfg_bitmap.c -o omfg_bitmap.test.o
omfg_bitmap.c: In function `SDL_main':
omfg_bitmap.c:123: warning: comparison of distinct pointer types lacks a cast
gcc -g -L. -L/home/matt/lib -o omfg_bitmap.test omfg_bitmap.test.o -lm
-lomfg -lopengl32 -lglu32 -lpng -lmu -L/usr/local/lib -lmingw32
-lSDLmain -lSDL -mwindows -mno-cygwin
omfg_bitmap.test.o(.text+0x34): In function `omfg_alloc_bitmap':
/home/matt/devel/omfg/omfg_bitmap.c:18: undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x56):/home/matt/devel/omfg/omfg_bitmap.c:19:
undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x80):/home/matt/devel/omfg/omfg_bitmap.c:20:
undefined reference to `___assert'
omfg_bitmap.test.o(.text+0xf5): In function `omfg_free_bitmap':
/home/matt/devel/omfg/omfg_bitmap.c:35: undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x141): In function `omfg_bitmap_pixel':
/home/matt/devel/omfg/omfg_bitmap.c:44: undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x170):/home/matt/devel/omfg/omfg_bitmap.c:45:
more undefined references to `___assert' follow
omfg_bitmap.test.o(.text+0x1f5): In function `omfg_is_valid_bitmap':
/home/matt/devel/omfg/omfg_bitmap.c:55: undefined reference to `__impure_ptr'
omfg_bitmap.test.o(.text+0x235):/home/matt/devel/omfg/omfg_bitmap.c:62:
undefined reference to `__impure_ptr'
omfg_bitmap.test.o(.text+0x288):/home/matt/devel/omfg/omfg_bitmap.c:67:
undefined reference to `__impure_ptr'
omfg_bitmap.test.o(.text+0x2ce):/home/matt/devel/omfg/omfg_bitmap.c:73:
undefined reference to `__impure_ptr'
omfg_bitmap.test.o(.text+0x316): In function `omfg_print_bitmap':
/home/matt/devel/omfg/omfg_bitmap.c:83: undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x424): In function `SDL_main':
/home/matt/devel/omfg/omfg_bitmap.c:117: undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x44a):/home/matt/devel/omfg/omfg_bitmap.c:118:
undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x493):/home/matt/devel/omfg/omfg_bitmap.c:123:
undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x4ee):/home/matt/devel/omfg/omfg_bitmap.c:129:
undefined reference to `___assert'
omfg_bitmap.test.o(.text+0x52b):/home/matt/devel/omfg/omfg_bitmap.c:130:
more undefined references to `___assert' follow
collect2: ld returned 1 exit status
make: *** [omfg_bitmap.test] Error 1


If the problem is object files being compiled without -mno-cygwin and
linked with it, do I need to make sure that all of the (static?)
libraries I link with are also compiled with -mno-cygwin?  Perhaps I
should try to build SDL _with_ Cygwin, since it's the package that's
introducing -mno-cygwin and linking issues.  All that's speculation,
though, since I don't really understand how -mno-cygwin affects the
linking process.

Thanks!
--Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]