dbTalk Databases Forums  

[BUGS] BUG #1311: Can't crosscompile

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1311: Can't crosscompile in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1311: Can't crosscompile - 11-10-2004 , 04:44 AM







The following bug has been logged online:

Bug reference: 1311
Logged by: Bernhard Rosenkraenzer

Email address: bero (AT) arklinux (DOT) org

PostgreSQL version: 8.0 Beta

Operating system: Ark Linux

Description: Can't crosscompile

Details:

Hi,
8.0.0beta4 can't be crosscompiled (I know that's hardly mainstream usage --
but I need the client libs on a PDA) because it tries to run the zic binary
it generated for the target platform rather than the build platform.

Quick and dirty [and not really portable] patch:

--- postgresql-8.0.0beta4/src/timezone/Makefile.ark 2004-11-10
06:59:27.000000000 +0100
+++ postgresql-8.0.0beta4/src/timezone/Makefile 2004-11-10
07:01:21.000000000 +0100
@@ -13,12 +13,14 @@
include $(top_builddir)/src/Makefile.global

override CPPFLAGS := $(CPPFLAGS)
+HOST_CC := gcc
+HOST_CFLAGS := $(CFLAGS)

# files to build into backend
OBJS= localtime.o strftime.o pgtz.o

# files needed to build zic utility program
-ZICOBJS= zic.o ialloc.o scheck.o localtime.o
+ZICSOURCES= zic.c ialloc.c scheck.c localtime.c

# timezone data files
TZDATA := africa antarctica asia australasia europe northamerica
southamerica \
@@ -30,8 +32,8 @@
SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)

-zic: $(ZICOBJS)
- $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
+zic: $(ZICSOURCES)
+ $(HOST_CC) $(HOST_CFLAGS) $(CPPFLAGS) $(ZICSOURCES) $(LDFLAGS)
$(LIBS) -o $@$(X)

install: all installdirs
./zic -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES)



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1311: Can't crosscompile - 11-10-2004 , 11:43 AM






"PostgreSQL Bugs List" <pgsql-bugs (AT) postgresql (DOT) org> writes:
Quote:
Quick and dirty [and not really portable] patch:
s/not really/not at all/

AFAICS this would take some fairly significant surgery in configure to
even have a prayer of working --- there's no reason to assume that the
host compiler has the same flags as the cross-compiler, for example.

An even bigger issue is that the files generated by zic might not be
machine-independent --- I haven't looked closely but they certainly
are binary data. If they are dependent on endianness or sizeof(int)
or whatever then this approach won't work at all.

In a cross-compile situation it'd probably be better to install the zic
executable and then run it later on the target system to generate the
timezone data files. Not sure what sort of makefile hacking might be
needed to bring this into the realm of possibility.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #3  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] BUG #1311: Can't crosscompile - 11-28-2004 , 09:21 PM




Added to TODO list:

* Allow cross-compiling by generating the zic database on the
target system


---------------------------------------------------------------------------

Tom Lane wrote:
Quote:
"PostgreSQL Bugs List" <pgsql-bugs (AT) postgresql (DOT) org> writes:
Quick and dirty [and not really portable] patch:

s/not really/not at all/

AFAICS this would take some fairly significant surgery in configure to
even have a prayer of working --- there's no reason to assume that the
host compiler has the same flags as the cross-compiler, for example.

An even bigger issue is that the files generated by zic might not be
machine-independent --- I haven't looked closely but they certainly
are binary data. If they are dependent on endianness or sizeof(int)
or whatever then this approach won't work at all.

In a cross-compile situation it'd probably be better to install the zic
executable and then run it later on the target system to generate the
timezone data files. Not sure what sort of makefile hacking might be
needed to bring this into the realm of possibility.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #4  
Old   
Richard Evans
 
Posts: n/a

Default Re: [BUGS] BUG #1311: Can't crosscompile - 12-15-2007 , 05:50 AM



The man page for tzfile(5) makes it clear that timezone files are
written in a portable format (big-endian always). So it is feasible to
run zic on the build system in a cross-compile.

Surely the simplest fix is to provide a configure option allows the use
of the host systems own /zic /command? Something like --with-system-zic.

Then cross compiles from any Unix-like system with a suitable zic will
work fine.

Richard

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.