YosysHQ / nextpnr

nextpnr portable FPGA place and route tool
ISC License
1.26k stars 238 forks source link

Build error on opensuse leap #467

Open marph91 opened 4 years ago

marph91 commented 4 years ago

I'm using opensuse leap and tried to build nextpnr from sources (commit 137241cfef385a68d2ce732a5b3283458790543d). Eigen 3.3.4 is installed. The build fails with the following output:

[ 68%] Building CXX object CMakeFiles/nextpnr-ice40.dir/common/placer_heap.cc.o
/home/martin/dev/nextpnr/common/placer_heap.cc:37:10: fatal error: Eigen/Core: Datei oder Verzeichnis nicht gefunden
 #include <Eigen/Core>
          ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/nextpnr-ice40.dir/build.make:197: CMakeFiles/nextpnr-ice40.dir/common/placer_heap.cc.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:226: CMakeFiles/nextpnr-ice40.dir/all] Fehler 2
make: *** [Makefile:147: all] Fehler 2

My workaround was to create a symbolic link sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen as described here. Another workaround would be to use # include <eigen3/Eigen/Core> instead of # include <Eigen/Core>.

I guess it works on other linux distributions, since I didn't find any related bug report. Is there a way to fix this for all distributions?

daveshah1 commented 4 years ago

Seems like the CMake find_package Eigen3 isn't working properly for some reason. Out of curiosity, what does pkg-config --cflags eigen3 show (I don't think cmake actually uses this but I would like to see what path it thinks it is installed to.)

marph91 commented 4 years ago
> pkg-config --cflags eigen3
-I/usr/include/eigen3
daveshah1 commented 4 years ago

Does /usr/share/cmake/Modules/FindEigen3.cmake exist? Are you sure that you are using system cmake and not, for example, Conda-provided cmake? This is certainly a mysterious failure.

marph91 commented 4 years ago

The file /usr/share/cmake/Modules/FindEigen3.cmake exists and looks correct.

I only have the system python installed. Anaconda or similar environments aren't installed.

I will try to search a bit more. Maybe this is a known problem with eigen3 + cmake + opensuse.

marph91 commented 3 years ago

Small update: There is a similar issue at openscad/openscad#2082. This points to the eigen source code. It seems like the EIGEN_* variables are legacy and shouldn't be used anymore.