This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1467 - CMake configure error when cross-compiling for QNX
Summary: CMake configure error when cross-compiling for QNX
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: 3.3 (current stable)
Hardware: x86 - 64-bit Other UNIX-like
: Normal Compilation Problem
Assignee: Nobody
URL:
Whiteboard:
Keywords: BuildSystem
Depends on:
Blocks:
 
Reported: 2017-09-15 08:53 UTC by Antonio El Khoury
Modified: 2019-12-04 17:11 UTC (History)
3 users (show)



Attachments
CMake configure log. (12.39 KB, text/x-log)
2017-09-15 08:53 UTC, Antonio El Khoury
no flags Details

Description Antonio El Khoury 2017-09-15 08:53:59 UTC
Created attachment 795 [details]
CMake configure log.

I tried to cross-compile eigen 3.3.4 from Ubuntu 14.04 to QNX 6.5.0 using the qcc compiler (which is based on a gcc 4.4.2).

During the CMake configure step, I get an error related to the fact that qcc does not support the argument `--version` (See qcc doc here http://www.qnx.com/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_utilities%2Fq%2Fqcc.html)

I managed to pull through using this patch, but it's definitely not a clean one:

```
diff -ru eigen3.orig/cmake/EigenTesting.cmake eigen3/cmake/EigenTesting.cmake
--- cmake/EigenTesting.cmake	2017-09-14 17:34:34.622709508 +0200
+++ cmake/EigenTesting.cmake	2017-09-14 17:36:30.378710602 +0200
@@ -550,7 +550,12 @@
 
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${EIGEN_CXX_FLAG_VERSION}
                     OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)
-    string(REGEX REPLACE "[\n\r].*"  ""  eigen_cxx_compiler_version_string  ${eigen_cxx_compiler_version_string})
+    if(${CMAKE_SYSTEM_NAME} STREQUAL QNX)
+      # Hardcode version.
+      set(eigen_cxx_compiler_version_string 4.4.2)
+    else()
+      string(REGEX REPLACE "[\n\r].*"  ""  eigen_cxx_compiler_version_string  ${eigen_cxx_compiler_version_string})
+    endif()
 
     ei_get_compilerver_from_cxx_version_string("${eigen_cxx_compiler_version_string}" CNAME CVER)
     set(${VAR} "${CNAME}-${CVER}")
```
Comment 1 Christoph Hertzberg 2017-09-15 10:49:16 UTC
According to the docu you linked to setting the following should work:

  set(EIGEN_CXX_FLAG_VERSION "-Wc,--version")

You may also need to adapt the ei_get_compilerver_from_cxx_version_string macro, to make this work. (I can't test this, since I don't have QNX installed).
Comment 2 Antonio El Khoury 2017-09-18 16:24:05 UTC
I tried your approach which sounds good, but qcc only returns an error. I think it's because the `--version` argument is not specific to the compiler.

I managed to make something work by generating an error message and catching it.

```
diff -ru eigen3.orig/cmake/EigenTesting.cmake eigen3/cmake/EigenTesting.cmake
--- cmake/EigenTesting.cmake	2017-09-18 13:07:07.233825416 +0200
+++ cmake/EigenTesting.cmake	2017-09-18 18:05:39.169994773 +0200
@@ -544,17 +544,21 @@
 
     if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} EQUAL "Intel")
       set(EIGEN_CXX_FLAG_VERSION "/version")
+    elseif(${CMAKE_SYSTEM_NAME} STREQUAL QNX)
+      set(EIGEN_CXX_FLAG_VERSION "-v")
     else()
       set(EIGEN_CXX_FLAG_VERSION "--version")
     endif()
 
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${EIGEN_CXX_FLAG_VERSION}
-                    OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)
+                    OUTPUT_VARIABLE eigen_cxx_compiler_version_string
+                    ERROR_VARIABLE eigen_cxx_compiler_version_string
+                    OUTPUT_STRIP_TRAILING_WHITESPACE
+                    ERROR_STRIP_TRAILING_WHITESPACE)
     string(REGEX REPLACE "[\n\r].*"  ""  eigen_cxx_compiler_version_string  ${eigen_cxx_compiler_version_string})
 
     ei_get_compilerver_from_cxx_version_string("${eigen_cxx_compiler_version_string}" CNAME CVER)
     set(${VAR} "${CNAME}-${CVER}")
-
   endif()
 endmacro(ei_get_compilerver)
 
@@ -569,6 +573,7 @@
   string(REGEX MATCH "gcc|GCC"      ei_has_gcc    ${VERSTRING})
   string(REGEX MATCH "icpc|ICC"     ei_has_icpc   ${VERSTRING})
   string(REGEX MATCH "clang|CLANG"  ei_has_clang  ${VERSTRING})
+  string(REGEX MATCH "qcc|QCC"      ei_has_qcc    ${VERSTRING})
 
   # combine them
   if((ei_has_llvm) AND (ei_has_gpp OR ei_has_gcc))
@@ -579,6 +584,8 @@
     set(${CNAME} "clang++")
   elseif(ei_has_icpc)
     set(${CNAME} "icpc")
+  elseif(ei_has_qcc)
+    set(${CNAME} "qcc")
   elseif(ei_has_gpp OR ei_has_gcc)
     set(${CNAME} "g++")
   else()
@@ -720,4 +727,5 @@
   ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")
   ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")
   ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")
+  ei_test1_get_compilerver_from_cxx_version_string("/opt/qnx650/host/linux/x86/etc/qcc/gcc/4.4.2/gcc_ntox86++.conf" "qcc" "_")
 endmacro(ei_test_get_compilerver_from_cxx_version_string)
```
Comment 3 Nobody 2019-12-04 17:11:42 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/1467.

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