Compile Error under 64-bit Linux

24 views
Skip to first unread message

NMani

unread,
Nov 3, 2009, 10:02:37 AM11/3/09
to GeoCommons Geocoder
I keep getting an error while trying to compile on my 64bit Linux. It
compiles fine on 32 bit. I'm not a C-programmer but I assume the code
just isn't written for 64 bit systems.

Sys info:
Linux TheBeast 2.6.27-14-generic #1 SMP Mon Oct 31 12:58:38 UTC 2009
x86_64 GNU/Linux

Log:
make -C src install
make[1]: Entering directory `/home/nmani/st_data/model/geocoder/src'
make -C libsqlite3_geocoder
make[2]: Entering directory `/home/nmani/st_data/model/geocoder/src/
libsqlite3_geocoder'
cc -c -o extension.o extension.c
cc -c -o wkb_compress.o wkb_compress.c
cc -c -o util.o util.c
cc -c -o metaphon.o metaphon.c
metaphon.c: In function ‘metaphone’:
metaphon.c:47: warning: cast to pointer from integer of different size
cc -c -o levenshtein.o levenshtein.c
cc -shared extension.o wkb_compress.o util.o metaphon.o levenshtein.o -
o libsqlite3_geocoder.so
/usr/bin/ld: extension.o: relocation R_X86_64_32 against `a local
symbol' can not be used when making a shared object; recompile with -
fPIC
extension.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libsqlite3_geocoder.so] Error 1
make[2]: Leaving directory `/home/nmani/st_data/model/geocoder/src/
libsqlite3_geocoder'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/nmani/st_data/model/geocoder/src'
make: *** [all] Error 2

Naveen Manivannan

unread,
Nov 4, 2009, 5:19:15 AM11/4/09
to GeoCommons Geocoder
Nevermind. I just put "CFLAGS = -fPIC" in the makefiles of the subdirectories that were giving me the problems and it compiled fine:


make -C src install
make[1]: Entering directory `/home/nmani/st_data/model/geocoder/src'
make -C libsqlite3_geocoder
make[2]: Entering directory
`/home/nmani/st_data/model/geocoder/src/libsqlite3_geocoder'
cc -fPIC   -c -o extension.o extension.c
cc -fPIC   -c -o wkb_compress.o wkb_compress.c
cc -fPIC   -c -o util.o util.c
cc -fPIC   -c -o metaphon.o metaphon.c

metaphon.c: In function ‘metaphone’:
metaphon.c:47: warning: cast to pointer from integer of different size
cc -fPIC   -c -o levenshtein.o levenshtein.c
cc -fPIC  -shared extension.o wkb_compress.o util.o metaphon.o

levenshtein.o -o libsqlite3_geocoder.so
make[2]: Leaving directory
`/home/nmani/st_data/model/geocoder/src/libsqlite3_geocoder'
make    -C liblwgeom
make[2]: Entering directory
`/home/nmani/st_data/model/geocoder/src/liblwgeom'
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o measures.o
measures.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o box2d.o
box2d.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o ptarray.o
ptarray.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgeom_api.o
lwgeom_api.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgeom.o
lwgeom.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwpoint.o
lwpoint.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwline.o
lwline.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwpoly.o
lwpoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmpoint.o
lwmpoint.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmline.o
lwmline.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmpoly.o
lwmpoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o
lwcollection.o lwcollection.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o
lwcircstring.o lwcircstring.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcompound.o
lwcompound.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwcurvepoly.o
lwcurvepoly.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmcurve.o
lwmcurve.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwmsurface.o
lwmsurface.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwutil.o
lwutil.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwalgorithm.o
lwalgorithm.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgunparse.o
lwgunparse.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lwgparse.o
lwgparse.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o
lwsegmentize.o lwsegmentize.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o
wktparse.tab.o wktparse.tab.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o lex.yy.o
lex.yy.c
lex.yy.c: In function ‘lwg_parse_yylex’:
wktparse.lex:73: warning: ignoring return value of ‘fwrite’, declared
with attribute warn_unused_result
wktparse.lex: At top level:
lex.yy.c:4127: warning: ‘yyunput’ defined but not used
lex.yy.c:4170: warning: ‘input’ defined but not used
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes  -c -o vsprintf.o
vsprintf.c
ar rs liblwgeom.a measures.o box2d.o ptarray.o lwgeom_api.o lwgeom.o
lwpoint.o lwline.o lwpoly.o lwmpoint.o lwmline.o lwmpoly.o
lwcollection.o lwcircstring.o lwcompound.o lwcurvepoly.o lwmcurve.o
lwmsurface.o lwutil.o lwalgorithm.o lwgunparse.o lwgparse.o
lwsegmentize.o wktparse.tab.o lex.yy.o vsprintf.o        
ar: creating liblwgeom.a
make[2]: Leaving directory
`/home/nmani/st_data/model/geocoder/src/liblwgeom'
make -C shp2sqlite
make[2]: Entering directory
`/home/nmani/st_data/model/geocoder/src/shp2sqlite'
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes   -c -o shpopen.o
shpopen.c
shpopen.c: In function ‘SHPWriteHeader’:
shpopen.c:315: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
shpopen.c:325: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
shpopen.c:340: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
shpopen.c: In function ‘SHPOpen’:
shpopen.c:455: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
shpopen.c:465: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
shpopen.c:544: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
shpopen.c: In function ‘SHPCreate’:
shpopen.c:713: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
shpopen.c:722: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
shpopen.c: In function ‘SHPReadObject’:
shpopen.c:1325: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes   -c -o dbfopen.o
dbfopen.c
dbfopen.c: In function ‘DBFWriteHeader’:
dbfopen.c:283: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c:284: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c:294: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFFlushRecord’:
dbfopen.c:317: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFUpdateHeader’:
dbfopen.c:337: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
dbfopen.c:345: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFClose’:
dbfopen.c:519: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
dbfopen.c:523: warning: ignoring return value of ‘fwrite’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFWriteAttribute’:
dbfopen.c:1112: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFWriteAttributeDirectly’:
dbfopen.c:1281: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFWriteTuple’:
dbfopen.c:1427: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
dbfopen.c: In function ‘DBFReadTuple’:
dbfopen.c:1471: warning: ignoring return value of ‘fread’, declared with
attribute warn_unused_result
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes   -c -o getopt.o
getopt.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes   -c -o shp2sqlite.o
shp2sqlite.c
gcc -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes shpopen.o dbfopen.o
getopt.o shp2sqlite.o ../liblwgeom/liblwgeom.a -lc -lm -o shp2sqlite
make[2]: Leaving directory
`/home/nmani/st_data/model/geocoder/src/shp2sqlite'
cp libsqlite3_geocoder/*.so ../lib/geocoder/us/sqlite3.so
make -C shp2sqlite install
make[2]: Entering directory
`/home/nmani/st_data/model/geocoder/src/shp2sqlite'
make[2]: Leaving directory
`/home/nmani/st_data/model/geocoder/src/shp2sqlite'

make[1]: Leaving directory `/home/nmani/st_data/model/geocoder/src'
gem build gemspec
WARNING:  no rubyforge_project specified
  Successfully built RubyGem
  Name: Geocoder-US
  Version: 2.0.0
  File: Geocoder-US-2.0.0.gem

I haven't tried it out yet but the 'make test' doesn't seem to work. It appears that all that is missing is a small, sample database that should be a part of the gem.

The paths for the other dbs in the test are absolute and not relative.

LOG:
ruby -Ilib tests/run.rb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- levenshtein (LoadError)
    from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from ./lib/geocoder/us/database.rb:4
    from ./tests/database.rb:4:in `require'
    from ./tests/database.rb:4
    from tests/run.rb:10:in `require'
    from tests/run.rb:10
make: *** [test] Error 1

database.rb:

require 'geocoder/us/database'  << no such database exists.

module Geocoder::US
  Database_File = (
    (ARGV[0] and !ARGV[0].empty?) ? ARGV[0] : "/Users/katechapman/shineygeocoder.db")
end

  def test_weird_country_stuff
     @geonames = Geocoder::US::Database.new( "/Users/katechapman/geonames.db")
     result = @geonames.geocode({:city => "Kabul", :state => "AF"})
     assert_equal result[0][:precision],:zip
   
  end
Reply all
Reply to author
Forward
0 new messages