--- a/src/roxml_mem.c
+++ b/src/roxml_mem.c
@@ -20,7 +20,7 @@ ROXML_STATIC ROXML_INT inline void roxml
 	memory_cell_t *ptr = &head_cell;
 	memory_cell_t *to_delete = NULL;
 
-	while ((ptr->prev != NULL) && (ptr->prev->id != pthread_self()))
+	while ((ptr->prev != NULL) && (ptr->prev->id != (unsigned long int)pthread_self()))
 		ptr = ptr->prev;
 
 	if (ptr->prev == NULL)
@@ -135,7 +135,7 @@ ROXML_INT void *roxml_malloc(int size, i
 	cell->next->prev = cell;
 	cell = cell->next;
 	cell->type = type;
-	cell->id = pthread_self();
+	cell->id = (unsigned long int)pthread_self();
 	cell->occ = size;
 	cell->ptr = calloc(num, size);
 	head_cell.prev = cell;
--- a/src/roxml_utils.h
+++ b/src/roxml_utils.h
@@ -48,7 +48,7 @@ ROXML_STATIC_INLINE ROXML_INT int roxml_
 #else /* CONFIG_XML_THREAD_SAFE==1 */
 ROXML_STATIC_INLINE ROXML_INT unsigned long int roxml_thread_id(node_t *n)
 {
-	return pthread_self();
+	return (unsigned long int)pthread_self();
 }
 
 ROXML_STATIC_INLINE ROXML_INT int roxml_lock_init(node_t *n)
