This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1468

Summary: Cross-compilation failure with qcc for QNX due to missing header inclusion
Product: Eigen Reporter: Antonio El Khoury <antonio.elkhoury>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Status: NEW ---    
Severity: Compilation Problem CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: x86 - 64-bit   
OS: Other UNIX-like   
Whiteboard:

Description Antonio El Khoury 2017-09-15 09:44:23 UTC
When cross-compiling from Ubuntu 14.04 to QNX 6.5.0 using qcc (based on gcc 4.4.2), I get the following build errors such as these ones:

```
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h: In function 'Eigen::half Eigen::half_impl::log(const Eigen::half&)':
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h:395: error: '::logf' has not been declared
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h: In function 'Eigen::half Eigen::half_impl::log10(const Eigen::half&)':
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h:402: error: '::log10f' has not been declared
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h: In function 'Eigen::half Eigen::half_impl::sqrt(const Eigen::half&)':
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/arch/CUDA/Half.h:405: error: '::sqrtf' has not been declared
```
```

```
/home/antonio/Public/install/QCC/include/eigen3/Eigen/src/Core/util/Memory.h:496: error: 'memcpy' was not declared in this scope
```

I managed to fix these errors with this patch, but I don't know if it's the best solution:

```
diff -ru eigen3.orig/Eigen/src/Core/arch/CUDA/Half.h eigen3/Eigen/src/Core/arch/CUDA/Half.h
--- Eigen/src/Core/arch/CUDA/Half.h	2017-09-14 17:53:15.318720104 +0200
+++ Eigen/src/Core/arch/CUDA/Half.h	2017-09-14 18:05:20.774726963 +0200
@@ -42,6 +42,7 @@
 #define EIGEN_EXPLICIT_CAST(tgt_type) operator tgt_type()
 #endif
 
+#include <math.h>
 
 namespace Eigen {
 
diff -ru eigen3.orig/Eigen/src/Core/util/Memory.h eigen3/Eigen/src/Core/util/Memory.h
--- Eigen/src/Core/util/Memory.h	2017-09-14 17:53:15.318720104 +0200
+++ Eigen/src/Core/util/Memory.h	2017-09-14 18:13:17.850731474 +0200
@@ -20,6 +20,8 @@
 #ifndef EIGEN_MEMORY_H
 #define EIGEN_MEMORY_H
 
+#include <string.h>
+
 #ifndef EIGEN_MALLOC_ALREADY_ALIGNED
 
 // Try to determine automatically if malloc is already aligned.
```
Comment 1 Christoph Hertzberg 2017-09-15 10:58:08 UTC
Could you try if replacing ::logf by std::log (or by numext::log), etc works as well?
Also, try replacing memcpy by std::memcpy (not sure why it is not there)
Comment 2 Antonio El Khoury 2017-09-21 14:18:47 UTC
> Could you try if replacing ::logf by std::log (or by numext::log), etc works as well?

Works, without the need to include any header.

> Also, try replacing memcpy by std::memcpy (not sure why it is not there)

Works, without the need to include any header.
Comment 3 Nobody 2019-12-04 17:11:53 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1468.