jeremyevans/home_run

duplicate symbol _rhrd_encoding_index in date_parser.o and date_ext.o

Closed this issue · 7 comments

make
gcc -I. -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i386-darwin9.8.0 -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -DRUBY19 -Wall -o date_ext.o -c date_ext.c
date_ext.c: In function ‘rhrd__modll’:
date_ext.c:114: warning: implicit conversion shortens 64-bit value into a 32-bit value
date_ext.c: In function ‘rhrd__unix_to_jd’:
date_ext.c:522: warning: implicit conversion shortens 64-bit value into a 32-bit value
date_ext.c: In function ‘rhrd_s__ragel_parse’:
date_ext.c:1481: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s__strptime’:
date_ext.c:1494: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_gregorian_leap_q’:
date_ext.c:1608: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_julian_leap_q’:
date_ext.c:1645: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_today’:
date_ext.c:1789: warning: unused parameter ‘argv’
date_ext.c: In function ‘rhrd_s_valid_civil_q’:
date_ext.c:1818: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_valid_commercial_q’:
date_ext.c:1858: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_valid_jd_q’:
date_ext.c:1893: warning: unused parameter ‘argv’
date_ext.c:1893: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_valid_ordinal_q’:
date_ext.c:1922: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_s_zone_to_diff’:
date_ext.c:1964: warning: unused parameter ‘klass’
date_ext.c: In function ‘rhrd_day_fraction’:
date_ext.c:2171: warning: unused parameter ‘self’
date_ext.c: In function ‘rhrd_gregorian_q’:
date_ext.c:2251: warning: unused parameter ‘self’
date_ext.c: In function ‘rhrd_julian_q’:
date_ext.c:2316: warning: unused parameter ‘self’
date_ext.c: In function ‘rhrd_new_start’:
date_ext.c:2401: warning: unused parameter ‘argv’
date_ext.c: In function ‘rhrd_start’:
date_ext.c:2422: warning: unused parameter ‘self’
gcc -I. -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i386-darwin9.8.0 -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -DRUBY19 -Wall -o date_parser.o -c date_parser.c
gcc -I. -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i386-darwin9.8.0 -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/opt/rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -DRUBY19 -Wall -o datetime.o -c datetime.c
datetime.c: In function ‘rhrdt__nanos_to_hms’:
datetime.c:185: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt__from_jd_nanos’:
datetime.c:313: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c:317: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt__add_days’:
datetime.c:360: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt__fill_from_hash’:
datetime.c:435: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt_s__strptime’:
datetime.c:558: warning: unused parameter ‘klass’
datetime.c: In function ‘rhrdt_s_new_b’:
datetime.c:768: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt_s_now’:
datetime.c:789: warning: unused parameter ‘argv’
datetime.c: In function ‘rhrdt_step’:
datetime.c:1454: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c:1473: warning: implicit conversion shortens 64-bit value into a 32-bit value
datetime.c: In function ‘rhrdt_to_time’:
datetime.c:2597: warning: implicit conversion shortens 64-bit value into a 32-bit value
gcc -dynamic -bundle -o date_ext.bundle date_ext.o date_parser.o datetime.o -L. -L/opt/rvm/rubies/ruby-1.9.2-p0/lib -L. -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lruby.1.9.1 -lpthread -ldl -lobjc
ld: duplicate symbol _rhrd_encoding_index in date_parser.o and date_ext.o
collect2: ld returned 1 exit status
make: *** [date_ext.bundle] Error 1

That looks like a bug. I wonder why none of my compilers complained? What compiler version are you using?

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5493~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 5493)

Hmm, maybe it's an issue with one of your compiler flags. Anyway, it certainly is a bug with the code, which will be fixed shortly.

Move global variable definition from header into source file (Closed by 1d444e4)

Looks like the issue was you had the -fno-common option enabled:

       In C, allocate even uninitialized global variables in
       the data section of the object file, rather than
       generating them as common blocks.  This has the effect
       that if the same variable is declared (without
       `extern') in two different compilations, you will get
       an error when you link them.  The only reason this
       might be useful is if you wish to verify that the
       program will work on other systems which always work
       this way.

I have this same problem building 0.9.1 in Snow Leopard, Ruby 1.9.2-p0. Some info:

Owl:~ javier$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~38/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)

Owl:~ javier$ cat ~/.rvmrc
rvm_archflags="-arch x86_64"

I can confirm that this is fixed when building from the master branch. Thanks.