From: Jim P. <ji...@wa...> - 2011-09-09 00:04:20
|
The configuration and Makefiles for ICU are so confusing I don't know how to rectify the visibility differences in the ICU libraries that happen when I execute make all. Quickly, the errors I see from make all include these: ld: warning: typeinfo for icu_48::UMemoryhas different visibility (default) in ../../lib/libicuuc.a(uobject.ao) and (hidden) in ../../lib/libicutu.a(toolutil.ao) ld: warning: typeinfo name for icu_48::UMemoryhas different visibility (default) in ../../lib/libicuuc.a(uobject.ao) and (hidden) in ../../lib/libicutu.a(toolutil.ao) In more detail, here's what I've done to build ICU: I downloaded and upacked the ICU 4.8.1 source into an icu top-level directory, and created an out-of-source igor_build subdirectory: Jims-Shiny-New-Mac-Pro:icu jim$ ls -l total 456 -rw-r--r--@ 1 jim admin 137511 Jul 19 14:19 APIChangeReport.html drwxr-xr-x@ 4 jim admin 136 Jul 19 14:19 as_is -rw-r--r--@ 1 jim admin 6683 Jul 19 14:19 icu4c.css drwxr-xr-x 24 jim admin 816 Sep 8 13:04 igor_build -rw-r--r--@ 1 jim admin 1981 Jul 19 14:19 license.html drwxr-xr-x@ 5 jim admin 170 Jul 19 14:19 packaging -rw-r--r-- 1 jim admin 74425 Jul 19 14:19 readme.html drwxr-xr-x@ 27 jim admin 918 Sep 8 11:20 source -rw-r--r--@ 1 jim admin 2932 Jul 19 14:19 unicode-license.txt (Igor is our product name, which I will statically link with the ICU libraries as needed.) $ cd igor_build $ ../source/runConfigureICU --enable-debug MacOSX --enable-static --disable-shared export CPP= CC= CXX= CPPFLAGS= CFLAGS= -O2 -g -O0 CXXFLAGS= -O2 -g -O0 LDFLAGS= MAKE= Running ./configure --enable-debug --enable-static --disable-shared for MacOS X (Darwin) using the GNU C++ compiler [omitted stuff...] If the result of the above commands looks okay to you, go to the directory source in the ICU distribution to build ICU. Please remember that ICU needs GNU make to build properly... $ make all [omitted stuff...] === Important Notes: === Data Packaging: static This means: ICU data will be stored in a static library. To locate data: ICU will use the linked data library. If linked with the stub library located in stubdata/, the application can use udata_setCommonData() or set a data path to override.[omitted stuff...] make[1]: Making `all' in `makeconv' [omitted stuff...] g++ -O2 -W -Wall -ansi -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -o ../../bin/makeconv makeconv.o ucnvstat.o genmbcs.o gencnvex.o -L../../lib -licutu -L../../lib -licui18n -L../../lib -licuuc -L../../stubdata -licudata -lpthread -lm ld: warning: typeinfo for icu_48::UMemoryhas different visibility (default) in ../../lib/libicuuc.a(uobject.ao) and (hidden) in ../../lib/libicutu.a(toolutil.ao) ld: warning: typeinfo name for icu_48::UMemoryhas different visibility (default) in ../../lib/libicuuc.a(uobject.ao) and (hidden) in ../../lib/libicutu.a(toolutil.ao) So during the linking for the makeconv tool, it has been revealed that at least one type has different visibilities between libicuuc.a and libicutu.a (at least; there are others). And yet, igor_build/icudefs.mk has what looks like the correct flags: # LIBCFLAGS are the flags for static and shared libraries. LIBCFLAGS = -fvisibility=hidden # LIBCXXFLAGS are the flags for static and shared libraries. LIBCXXFLAGS = -fvisibility=hidden *IF* these are used properly when the libraries are built, the libraries would all have the same visibility for UMemory, no? *HOWEVER*, LIBCFLAGS and LIBCXXFLAGS are not included in the COMPILE.c/cc or LINK.c/cc definitions in icudefs.mk: LDFLAGS = $(RPATHLDFLAGS) ... # Commands to compile COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c # Commands to link LINK.c= $(CC) $(CFLAGS) $(LDFLAGS) LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) So it is apparently up to each Makefile (Makefile.in probably?) to use $(LIBCFLAGS) and $(LIBCXXFLAGS) appropriately. For example, I see that source/common/Makefile.in and igor_build/common/Makefile have: CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) So I'd think that things built by that Makefile could be correct. libicuuc.a seems the odd man out, here. And I see in icu/source/tools/genren/Makefile: COM=$(ICUDIR)/lib/libicuuc.$(SO) ... $(COM): $(DAT) $(ICUDIR)/config.status Makefile $(MAKE) $(FLAG_OVERRIDE) -C $(ICUDIR)/common all-local that libicuuc is built by running Make in the (ICUDIR)/common directory, which is the Makefile mentioned above with the correct CFLAGS and CXXFLAGS. Since there is no rule for building the library object files (uobject.ao, for example) the implicit make rules apply, and these use CFLAGS and CXXFLAGS as if these rules were in the Makefile: %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ %.o : %.cpp $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ The Makefile takes the compiled object files and combines them into an archive: ifneq ($(ENABLE_STATIC),) $(TARGET): $(STATIC_OBJECTS) $(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $^ $(RANLIB) $@ endif I get lost at this point because it seems that libicuuc.a should be using -fvisibility=hidden just fine. I'm stymied; what's gone wrong here? Some kind of bug in a makefile.in file somewhere? Can I add a -D somethingOrOther to runConfigureICU so that -fvisibility=hidden gets to the appropriate commands? Full transcript of the build (and nm output) can be downloaded from here: http://www.wavemetrics.net/ICUBuildTranscriptSep08_2911.txt ======================================================================== Jim "How does it work?" Prouty Voice: (503) 620-3001, FAX: (503) 620-6754 Makers of IGOR Pro, scientific data analysis and graphing for Mac and PC http://www.wavemetrics.com |