Bug 690699 - Undefined references when building with --no-undefined
Summary: Undefined references when building with --no-undefined
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: Hin-Tak Leung
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-08 12:46 UTC by fhimpe
Modified: 2023-10-03 13:06 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fhimpe 2009-08-08 12:46:33 UTC
ghostscript 8.70 fails to build with the LDFLAG --no-undefined. Previous
releases of ghostscript built fine with this flags.

gcc -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,--as-needed
-Wl,--no-undefined -Wl,-z,relro  -shared -o ./obj/X11.so ./obj/gdevxalt.o
./obj/gdevx.o ./obj/gdevxcmp.o ./obj/
gdevxini.o ./obj/gdevxres.o ./obj/gdevxxf.o ./obj/gdevemap.o ./obj/gsparamx.o
-L/usr/X11R6/lib -lXt -lSM -lICE -lXext -lX11 
./obj/gdevxalt.o: In function `gdevx_wrapper_enum_ptrs':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:51: undefined
reference to `st_device_forward'
./obj/gdevxalt.o: In function `gdevx_wrapper_reloc_ptrs':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:51: undefined
reference to `st_device_forward'
./obj/gdevxalt.o: In function `x_alpha_map_rgb_alpha_color':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:742: undefined
reference to `gx_forward_map_rgb_color'
./obj/gdevxalt.o: In function `x_clear_color_cache':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:72: undefined
reference to `gx_device_decache_colors'
./obj/gdevxalt.o: In function `get_dev_target':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:402: undefined
reference to `gs_copydevice'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:407: undefined
reference to `check_device_separable'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:408: undefined
reference to `gx_device_fill_in_procs'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:409: undefined
reference to `gx_device_set_target'
./obj/gdevxalt.o: In function `x_wrap_copy_color':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:191: undefined
reference to `gx_default_copy_color'
./obj/gdevxalt.o: In function `x_cmyk_set_procs':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:580: undefined
reference to `cmyk_1bit_map_cmyk_color'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:580: undefined
reference to `cmyk_1bit_map_cmyk_color'
./obj/gdevxalt.o: In function `x_wrap_close':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:123: undefined
reference to `gx_device_set_target'
./obj/gdevxalt.o: In function `gs_shared_init':
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:852: undefined
reference to `gs_lib_register_device'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:853: undefined
reference to `gs_lib_register_device'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:854: undefined
reference to `gs_lib_register_device'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:855: undefined
reference to `gs_lib_register_device'
/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:856: undefined
reference to `gs_lib_register_device'
./obj/gdevxalt.o:/home/fhimpe/ghostscript/BUILD/ghostscript-8.70/./base/gdevxalt.c:857:
more undefined references to `gs_lib_register_device' follow
./obj/gdevxalt.o:(.data.rel.ro+0x3bc): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x3c0): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x3c4): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x91c): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x920): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x924): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0xe7c): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0xe80): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0xe84): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x13dc): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x13e0): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x13e4): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x193c): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x1940): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x1944): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x1e9c): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x1ea0): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x1ea4): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x23fc): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x2400): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x2404): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x295c): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x2960): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x2964): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x2ebc): undefined reference to `gx_default_install'
./obj/gdevxalt.o:(.data.rel.ro+0x2ec0): undefined reference to
`gx_default_begin_page'
./obj/gdevxalt.o:(.data.rel.ro+0x2ec4): undefined reference to `gx_default_end_page'
./obj/gdevxalt.o:(.data.rel.ro+0x3064): undefined reference to
`gx_forward_get_initial_matrix'
./obj/gdevxalt.o:(.data.rel.ro+0x3080): undefined reference to
`gx_default_tile_rectangle'
./obj/gdevxalt.o:(.data.rel.ro+0x308c): undefined reference to
`gx_default_draw_line'
[...]
Comment 1 Ray Johnston 2009-08-13 09:39:10 UTC
why do you need LDFLAGS=--no-undefined ?
Comment 2 fhimpe 2009-08-13 11:06:20 UTC
It's used by default on Mandriva in combination with --as-needed to prevent
underlinking and overlinking problems. Libraries and applications should link
with exactly the libraries they need, not with more or less libraries, as this
makes maintaining stuff more complex if the major of one of these library
changes. Better and more detailed explanation:

http://wiki.mandriva.com/en/Underlinking
http://wiki.mandriva.com/en/Overlinking

The previous ghostscript releases build fine with --as-needed --no-undefined, so
it's a regression in 8.70.
Comment 3 fhimpe 2010-02-11 12:16:20 UTC
Build still fails with 8.71
Comment 4 Hin-Tak Leung 2010-02-12 00:11:23 UTC
When was the last time --no-defined worked? Most of those "undefined" symbols
are in libgs.so (or libgs.so.8), so maybe all you need is just adding -L ./sobin
-lgs or some such to the command line.

I suspect the last time it worked was before the x11 device got modularised -
i.e. before 8.57-8.60-ish when Till's esp changes were merged. Did it ever
worked with 8.6x?
Comment 5 Hin-Tak Leung 2010-02-12 18:30:45 UTC
Hmm, the missing symbols in X11.so is provided either by the main gs executable
or libgs.so - it is similiar to perl module or the mpg123 plug-ins, and X11.so
is dlopened by the main executable when needed, not for general usage. Probably
more appropriate to simply not use --no-undefined . 
Comment 6 Hin-Tak Leung 2010-02-12 19:00:55 UTC
actually  '--no-undefined' doesn't work only because of --enable-dynamic (which
builds the X11 driver as module) . The default (just ./configure with
CFLAGS=-fPIC and LDFLAGS='-Wl,--as-needed -Wl,--no-undefined') which have the
X11 driver built-in, does work. 
Comment 7 Hin-Tak Leung 2010-02-12 19:02:44 UTC
It is probably appropriate to make X11.so linked to libgs.so (and make X11.so
part of the so target), but that's rather low priority.
Comment 8 Hin-Tak Leung 2010-05-02 03:12:48 UTC
Grabbing a Ralph's bugs.
Comment 9 Hin-Tak Leung 2010-07-28 03:48:56 UTC
'--no-undefined' doesn't work because of --enable-dynamic, which you appear to have added some time between 8.60 (when --enable-dynamic was introduced) and the reported "regression". So you have a choice of not specifying "--enable-dynamic", or live with the consequence of those warnings coming out of '--no-undefined'.