Hi List I got some help from a guy called Kevin on the SuSE PPC mailing list to solve this problem. Here is Kevins explanation of the problem:
************************************************************ Hi Jacob, Arrgghh! They are passing addresses of va_lists all over the place. Under ppc linux and s390 linux, va_list is actualy based on an array type. So they are trying to pass the address of the array (which itself is a pointer) and all hell breaks loose. They then assume the *args is a va_list argument everyplace. Passing addresses of a va_list is not portable in any way AFAIK. I have no idea if what I did even compiles but you should get the general idea. Just think that va_list is an array. Taking the address of an array makes no sense (you pass the array and it is automatically a pointer) and then taking the contents of that also can be an issue. Whereas passing the address of an element of the array is perfectly fine. I tried something using macros that may do the trick. Hope this helps. Kevin *************************************************************** After minor corrections in the files he sent me I finally got it working. It works with both version 1.1.5 and the cvs version. I've attached the new octstr.c file. Jacob -----Original Message----- From: Jörg Pommnitz [mailto:[EMAIL PROTECTED]] Sent: 12. december 2001 12:35 To: Jacob Vennervald Madsen Cc: '[EMAIL PROTECTED]' Subject: varargs problem and PPC Hi Jacob, I did a quick Google search for varargs and PPC and it seems that this is really special on this architecture. I suspect that the current Kannel code is incompatible with the PPC varags ABI. Since I do not have access to such hardware I'm afraid I cannot help you. Your best bet would be to upgrade your glibc. If this still fails, you might want to try Darwin on this machine. Andreas Fink reports that Kannel works just fine with MacOSX on PPC, so Darwin should be OK as well. I don't know whether Darwin runs on IBM hardware. Alternatively one of the other BSD ports to the PPC should be fine, too. After all, Darwin is BSD based. Regards Jörg -----Original Message----- From: Jacob Vennervald Madsen To: Jörg Pommnitz Sent: 12/12/01 10:10 AM Subject: RE: Ref-Counted octstr I've done that and I've left out -lssl as well. When i try to run it I get a Segmentation fault again. The backtrace from debugging gives me this: #0 0x10010728 in convert (os=0x10150eb0, format=0x7ffff678, fmt=0x7ffff698, args=0x7ffff69c) at gwlib/octstr.c:1841 #1 0x10010e94 in octstr_format_valist (fmt=0x1001721f "d\", a String \"%s\" and an Octstr \"%S\"", args=0x7ffff730) at gwlib/octstr.c:1989 #2 0x10010d0c in octstr_format (fmt=0x0) at gwlib/octstr.c:1960 #3 0x10001760 in main () #4 0x0fda7680 in __libc_start_main () from /lib/libc.so.6 Jacob -----Original Message----- From: Jörg Pommnitz [mailto:[EMAIL PROTECTED]] Sent: 12. december 2001 09:43 To: Jacob Vennervald Madsen Subject: RE: Ref-Counted octstr Leave -lcrypto out of the compile command. Regards Jörg -----Original Message----- From: Jacob Vennervald Madsen To: Jörg Pommnitz Sent: 12/12/01 9:21 AM Subject: RE: Ref-Counted octstr This is what I get when trying to compile the code you sent me: /usr/powerpc-suse-linux/bin/ld: cannot find -lcrypto collect2: ld returned 1 exit status Jacob -----Original Message----- From: Jörg Pommnitz [mailto:[EMAIL PROTECTED]] Sent: 11. december 2001 17:21 To: Jacob Vennervald Madsen Subject: RE: Ref-Counted octstr Yes, I saw it. I'm unsure what's going on. The gdb backtrace you posted did show that a pointer was NULL that should not be. Please run the following program: #include "gwlib/gwlib.h" int main (int argc, char*argv[]) { Octstr *result; gwlib_init(); result = octstr_format("A number \"%d\", a String \"%s\" and an Octstr \"%S\"", 123, "the C string", octstr_imm("the Octstr")); debug ("debug", 0, "Result: %s", octstr_get_cstr(result)); octstr_destroy (result); gwlib_shutdown(); return 0; } Compile it with gcc -I ../gateway -o bug bug.c ../gateway/libgwlib.a -lcrypto -lssl -lpthread -lxml2 Regards Jörg -----Original Message----- From: Jacob Vennervald Madsen To: Jörg Pommnitz Sent: 12/11/01 5:00 PM Subject: RE: Ref-Counted octstr Did you se the warnings I get when I compile? I posted them earlier today. Jacob -----Original Message----- From: Jörg Pommnitz [mailto:[EMAIL PROTECTED]] Sent: 11. december 2001 16:50 To: Jacob Vennervald Madsen Subject: RE: Ref-Counted octstr It should not hurt, but it is completely unrelated to your problem. Regards Jörg -----Original Message----- From: Jacob Vennervald Madsen To: Jörg Pommnitz Sent: 12/11/01 4:47 PM Subject: RE: Ref-Counted octstr Hi Jörg Is this something that would make it work on the IBM RS/6000 ? Jacob -----Original Message----- From: Jörg Pommnitz [mailto:[EMAIL PROTECTED]] Sent: 11. december 2001 16:44 To: '[EMAIL PROTECTED]' Subject: Ref-Counted octstr Hi List, there is a number of unneeded octstr_duplicate calls in the tree. These calls could easily be replaced by a octstr_getref that increments a refcounter inside the octstr. A refcount > 1 would make the octstr immutable (e.g. calls that modify the contents are forbidden). octstr_destroy would decrement the refcounter. Reaching zero would actually destroy the entity. All these things seem rather easy and sensible. What do you think? Regards Jörg
octstr.c
Description: octstr.c