New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1468 - Cross-compilation failure with qcc for QNX due to missing header inclusion
Summary: Cross-compilation failure with qcc for QNX due to missing header inclusion
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 64-bit Other UNIX-like
: Normal Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-15 09:44 UTC by Antonio El Khoury
Modified: 2017-09-21 14:18 UTC (History)
3 users (show)



Attachments

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.

Note You need to log in before you can comment on or make changes to this bug.