[OSM-dev] [novice] osm2pgsql: mac os x: faster with compiler optimized flag -fast instead of -O2

Ceriel Jacobs cerieljacobs at gmail.com
Sat Feb 7 22:09:47 GMT 2009


In building and benchmarking open source projects on Mac OS X 10.5  
intel (for example Mysql),
highest performance was returned with flag -fast instead of -O2.

When trying to apply these settings to the osm2pgsql Makefile, by  
replacing:
1. CFLAGS += -g -O2 -Wall -Wextra
with
1. CFLAGS += -g -fast -Wall -Wextra
and
2. CXXFLAGS += -g -O2 -Wall -DGEOS_INLINE $(CFLAGS)
with
2. CXXFLAGS += -g -fast -Wall -DGEOS_INLINE $(CFLAGS)

Checked out revision 13576, returns several errors when trying to make  
(see below).

Has anyone tried this -fast FLAG in the make process of osm2pgsql?
Or will this definately not work, and why?

~Ceriel

---
Environment:
a. Mac OS X 10.5.6,
b. gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5490~1/src/configure --disable- 
checking -enable-werror --prefix=/usr --mandir=/share/man --enable- 
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/ 
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/ 
lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic -- 
host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5490)
c. dependencies like geos installed through MacPorts, and /opt/local/ 
bin appended to $PATH
---
$ make
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o UTF8sanitizer.o UTF8sanitizer.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o input.o input.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o keyvals.o keyvals.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o middle-pgsql.o middle-pgsql.c
middle-pgsql.c:211:1: warning: "__unused" redefined
In file included from /usr/include/sys/_types.h:32,
                  from /usr/include/_types.h:27,
                  from /usr/include/stdio.h:64,
                  from middle-pgsql.c:9:
/usr/include/sys/cdefs.h:145:1: warning: this is the location of the  
previous definition
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o middle-ram.o middle-ram.c
middle-ram.c:97:1: warning: "__unused" redefined
In file included from /usr/include/sys/_types.h:32,
                  from /usr/include/_types.h:27,
                  from /usr/include/stdio.h:64,
                  from middle-ram.c:10:
/usr/include/sys/cdefs.h:145:1: warning: this is the location of the  
previous definition
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o osm2pgsql.o osm2pgsql.c
osm2pgsql.c: In function 'usage':
osm2pgsql.c:450: warning: implicit declaration of function 'basename'
osm2pgsql.c:450: warning: initialization makes pointer from integer  
without a cast
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o output-pgsql.o output-pgsql.c
output-pgsql.c:1153:1: warning: "__unused" redefined
In file included from /usr/include/sys/_types.h:32,
                  from /usr/include/_types.h:27,
                  from /usr/include/stdio.h:64,
                  from output-pgsql.c:9:
/usr/include/sys/cdefs.h:145:1: warning: this is the location of the  
previous definition
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o pgsql.o pgsql.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o rb.o rb.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o reprojection.o reprojection.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o sprompt.o sprompt.c
gcc -g -fast -Wall -Wextra -I/usr/include/libxml2 -I/opt/local/include  
-I/opt/local/include/postgresql83 -DVERSION=\"0.60-20090207\" - 
DHAVE_PTHREAD   -c -o text-tree.o text-tree.c
g++ -g -fast -Wall -DGEOS_INLINE -g -fast -Wall -Wextra -I/usr/include/ 
libxml2 -I/opt/local/include -I/opt/local/include/postgresql83 - 
DVERSION=\"0.60-20090207\" -DHAVE_PTHREAD -I/opt/local/include   -c -o  
build_geometry.o build_geometry.cpp
g++ -o osm2pgsql UTF8sanitizer.o input.o keyvals.o middle-pgsql.o  
middle-ram.o osm2pgsql.o output-pgsql.o pgsql.o rb.o reprojection.o  
sprompt.o text-tree.o build_geometry.o -L/usr/lib -lxml2 -lz -lpthread  
-licucore -lm  -L/opt/local/lib -lgeos -L/opt/local/lib/postgresql83 - 
lpq -lbz2 -lz -g -lproj -lstdc++ -lpthread
ld: duplicate symbol _out_pgsql in middle-ram.o and middle-pgsql.o
collect2: ld returned 1 exit status
make: *** [osm2pgsql] Error 1





More information about the dev mailing list