www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking problems with mintl

reply Nick <Nick_member pathlink.com> writes:
(Sorry if this post comes twice.) I'm sure I'm doing something stupid here, but
shouldn't this work?

import mintl.slist;
class MyClass{}
alias SList!(MyClass) MyList;
void main() {}

I get the following result:

$ dmd bug.d libmintl_debug.a

gcc bug.o -o bug ../../software/lib/libmintl_debug.a -lphobos -lpthread -lm
-Xlinker
-L/mn/tid/teori-s1/mortennk/uhh___filerogslikt/software/lib
bug.o(.gnu.linkonce.t_D5mintl5slist19SList_C3bug7MyClass5SList238MCommonSList_S5mintl5slist19SNode_C3bug7MyClass5SNode__88__D5mintl5slist19SList_C3bug7MyClass5SList4headPS5mintl5slist19SNode_C3bug7MyClass5SNodeS5mintl5slist19SList_C3bug7MyClass5SListC3bug7MyClassS5mintl5slist19SList_C3bug7MyClass5SList8opEqualsFS5mintl5slist19SList_C3bug7MyClass5SListZi+0x4a):
In function
`_D5mintl5slist19SList_C3bug7MyClass5SList238MCommonSList_S5mintl5slist19SNode_C3bug7MyClass5SNode__88__D5mintl5slist19SList_C3bug7MyClass5SList4headPS5mintl5slist19SNode_C3bug7MyClass5SNodeS5mintl5slist19SList_C3bug7MyClass5SListC3bug7MyClassS5mintl5slist19SList_C3bug7MyClass5SList8opEqualsFS5mintl5slist19SList_C3bug7MyClass5SListZi':
: undefined reference to `_init_22TypeInfo_C3bug7MyClass'
bug.o(.gnu.linkonce.t_D5mintl5slist19SList_C3bug7MyClass5SList71MListCatOperators_C3bug7MyClassS5mintl5slist19SList_C3bug7MyClass5SList3addFYv+0x2c):
In function
`_D5mintl5slist19SList_C3bug7MyClass5SList71MListCatOperators_C3bug7MyClassS5mintl5slist19SList_C3bug7MyClass5SList3addFYv':
: undefined reference to `_init_22TypeInfo_C3bug7MyClass'
collect2: ld returned 1 exit status
--- errorlevel 1

I am using dmd 0.119 on linux. What am I doing wrong?

Nick
Apr 08 2005
parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Nick" <Nick_member pathlink.com> wrote in message 
news:d36bed$2s31$1 digitaldaemon.com...
 (Sorry if this post comes twice.) I'm sure I'm doing something stupid 
 here, but
 shouldn't this work?

 import mintl.slist;
 class MyClass{}
 alias SList!(MyClass) MyList;
 void main() {}
I don't have my Linux box near me right now - I tried it on Windows and it work ok (with dmd119) so there could be a problem with linux library. Change to the mintl library and try "make -f linux.mak" (though one needs to pay attention to the DFLAGS to see if it is building a debug or non-debug build). Given that it is erroring in a template function, though, I'm somewhat dubious that the library is really the culprit. It it interesting that it is complaining about opEquals since that is what currently causes build problems with dmd-120 (the latest error is opEquals taking List* or List argument). Unfortunately I only be able to see what's going on after the weekend. -Ben
Apr 08 2005
parent reply Nick <Nick_member pathlink.com> writes:
In article <d36gtr$om$1 digitaldaemon.com>, Ben Hinkle says...
I don't have my Linux box near me right now - I tried it on Windows and it 
work ok (with dmd119) so there could be a problem with linux library. Change 
to the mintl library and try "make -f linux.mak" (though one needs to pay 
attention to the DFLAGS to see if it is building a debug or non-debug 
build). Given that it is erroring in a template function, though, I'm 
somewhat dubious that the library is really the culprit. It it interesting 
that it is complaining about opEquals since that is what currently causes 
build problems with dmd-120 (the latest error is opEquals taking List* or 
List argument). Unfortunately I only be able to see what's going on after 
the weekend.
Rebuilding the lib didn't seem to help anything. However, I do get the following linker warnings when rebuilding the unittest (and my own program too): /usr/bin/ld: Warning: size of symbol `_D3std6stdarg8va_arg_i6va_argFKPvZi' changed from 18 in libmintl_debug.a(arraylist.o) to 21 in libmintl_debug.a(arraylist.o) /usr/bin/ld: Warning: size of symbol `_D3std6stdarg9va_arg_Aa6va_argFKPvZAa' changed from 23 in libmintl_debug.a(arraylist.o) to 34 in libmintl_debug.a(arraylist.o) I don't know if this is related or helps anything. Nick
Apr 08 2005
parent "Ben Hinkle" <bhinkle mathworks.com> writes:
 Rebuilding the lib didn't seem to help anything. However, I do get the 
 following
 linker warnings when rebuilding the unittest (and my own program too):

 /usr/bin/ld: Warning: size of symbol `_D3std6stdarg8va_arg_i6va_argFKPvZi'
 changed from 18 in libmintl_debug.a(arraylist.o) to 21 in
 libmintl_debug.a(arraylist.o)
 /usr/bin/ld: Warning: size of symbol 
 `_D3std6stdarg9va_arg_Aa6va_argFKPvZAa'
 changed from 23 in libmintl_debug.a(arraylist.o) to 34 in
 libmintl_debug.a(arraylist.o)

 I don't know if this is related or helps anything.
The warnings are safe to ignore (from what I've been told). I get those, too, on Linux in stuff using varargs.
Apr 08 2005