Hi Mark,
Thanks for your feedback. It seems that all of a sudden everybody starts
building for 64bit architectures.
Today I received the error in stun.cxx from another user as well.
Attached is a patch for the errors in stun.cxx and memman.cpp
I have no 64-bit machine myself. So I cannot verify if it works, but I
think it does.
If it works I will include the changes in the next version. As I am
about to leave for a 4-week
holiday it will take a while before I release a new version.
Regards,
Michel
Mark Purcell wrote:
Michel,
Thanks for your development of twinkle it is make for a great VoIP
softphone.
I have packaged it up for the Debian GNU/Linux distribution, but have
encountered a number of problems on various architectures, including
64 bit as attached in this report from kurt.
I have also seen the following error on the mips build.
stun.cxx:684:7: error: #error Need some way to seed the random number
generator
The Debian packages are avilable at http://packages.debian.org/twinkle
however you maybe more interested in the buildd logs at
http://buildd.debian.org/build.php?pkg=twinkle
You might like to investigate these issues and incorporate the changes
into your upstream tarballs.
Mark
------------------------------------------------------------------------
Subject:
Bug#324395: twinkle: FTBFS on 64 bit arches: cast from 'void*' to
'int' loses precision
From:
Kurt Roeckx <[EMAIL PROTECTED]>
Date:
Mon, 22 Aug 2005 00:06:06 +0200
To:
[EMAIL PROTECTED]
To:
[EMAIL PROTECTED]
Package: twinkle
Version: 0.1-2
Severity: important
Hi,
Your package is failing to build on 64 bit arches with the
following error:
if ia64-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I ../../src -I
/usr/include -g -O2 -I/usr/include/cc++2 -D_GNU_SOURCE -MT memman.o -MD -MP -MF
"
.deps/memman.Tpo" -c -o memman.o memman.cpp; \
then mv -f ".deps/memman.Tpo" ".deps/memman.Po"; else rm -f ".deps/memman.Tpo";
exit 1; fi
memman.cpp: In member function 'void t_memman::trc_new(void*, const std::string
&, int, bool)':
memman.cpp:66: error: cast from 'void*' to 'int' loses precision
memman.cpp: In member function 'void t_memman::trc_delete(void*, const std::str
ing&, int, bool)':
memman.cpp:103: error: cast from 'void*' to 'int' loses precision
memman.cpp:120: error: cast from 'void*' to 'int' loses precision
memman.cpp: In member function 'void t_memman::report_leaks()':
memman.cpp:173: error: cast from 'void*' to 'int' loses precision
make[4]: *** [memman.o] Error 1
Kurt
--
Michel de Boer
www.twinklephone.com
--- src/util.h (revision 42)
+++ src/util.h (working copy)
@@ -38,6 +38,9 @@
string ulong2str(unsigned long i, const char *format);
string ulong2str(unsigned long i);
+// Convert a pointer to a string (hexadecimal)
+string ptr2str(void *p);
+
// Convert a bool to a string: "false", "true"
string bool2str(bool b);
--- src/util.cpp (revision 42)
+++ src/util.cpp (working copy)
@@ -76,6 +76,13 @@
return ulong2str(i, "%u");
}
+string ptr2str(void *p) {
+ char buf[32];
+
+ snprintf(buf, 32, "%p", p);
+ return string(buf);
+}
+
string bool2str(bool b) {
return (b ? "true" : "false");
}
--- src/audits/memman.cpp (revision 42)
+++ src/audits/memman.cpp (working copy)
@@ -63,7 +63,7 @@
log_file->write_raw(", line ");
log_file->write_raw(lineno);
log_file->write_raw(": pointer to ");
- log_file->write_raw(int2str(int(p), "0x%x"));
+ log_file->write_raw(ptr2str(p));
log_file->write_raw(" has already been allocated.\n");
log_file->write_raw("It was allocated here: ");
log_file->write_raw(i->second.filename);
@@ -100,7 +100,7 @@
log_file->write_raw(", line ");
log_file->write_raw(lineno);
log_file->write_raw(": pointer to ");
- log_file->write_raw(int2str(int(p), "0x%x"));
+ log_file->write_raw(ptr2str(p));
log_file->write_raw(" is deleted.\n");
log_file->write_raw("This pointer is not allocated however.\n");
log_file->write_footer();
@@ -117,7 +117,7 @@
log_file->write_raw(", line ");
log_file->write_raw(lineno);
log_file->write_raw(": pointer to ");
- log_file->write_raw(int2str(int(p), "0x%x"));
+ log_file->write_raw(ptr2str(p));
log_file->write_raw(" is deleted ");
if (is_array) {
log_file->write_raw(" as array (delete []).\n");
@@ -170,7 +170,7 @@
for (map<void *, t_ptr_info>::const_iterator i = pointer_map.begin();
i != pointer_map.end(); i++)
{
- log_file->write_raw(int2str(int(i->first), "0x%x"));
+ log_file->write_raw(ptr2str(i->first));
log_file->write_raw(" allocated from ");
log_file->write_raw(i->second.filename);
log_file->write_raw(", line ");
--- src/stun/stun.cxx (revision 42)
+++ src/stun/stun.cxx (working copy)
@@ -660,6 +660,8 @@
init = true;
UInt64 tick;
+
+// Twinkle: I added __x86_64__ for amd64 compiler
#if defined(WIN32)
volatile unsigned int lowtick=0,hightick=0;
@@ -672,7 +674,7 @@
tick = hightick;
tick <<= 32;
tick |= lowtick;
-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
+#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) || defined(__x86_64__) )
asm("rdtsc" : "=A" (tick));
#elif defined (__SUNPRO_CC) || defined( __sparc__ )
tick = gethrtime();