eteran / nedit-ng

a Qt5 port of the NEdit using modern C++14
GNU General Public License v2.0
95 stars 26 forks source link

Build issue with current head #321

Closed cvmiller closed 2 years ago

cvmiller commented 2 years ago

Just a heads up, with the current git repo (commit de2f4b158fdda09270af0aa00fd8e6e4f3336134 ) when trying to run cmake .. results in the following error:

cvmiller@maker:~/nedit-ng/build$ cmake ..
CMake Error at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/AddWarnings.cmake:2 (include)
  CMakeLists.txt:10 (include)

-- Configuring incomplete, errors occurred!
See also "/home/cvmiller/nedit-ng/build/CMakeFiles/CMakeOutput.log".
See also "/home/cvmiller/nedit-ng/build/CMakeFiles/CMakeError.log".
cvmiller@maker:~/nedit-ng/build$ which gittk

If I use the latest release 2020.1, cmake .. works fine.

eteran commented 2 years ago

Interesting, looks like for some reason the compiler detection is failing. I'll take a look at it and see what could be going wrong.

Thanks for the report!

eteran commented 2 years ago

So for some reason, the variable CMAKE_CXX_COMPILER_ID is an empty string on your machine. According to this stackoverflow link (https://stackoverflow.com/questions/20904914/cmake-compiler-is-gnucxx-and-cmake-cxx-compiler-id-are-empty) that could be caused by the check being before the project directive... but the we set the project basically right away.

Can you tell me more about your setup? What OS/compiler/etc you are trying to build on?

cvmiller commented 2 years ago

It is true CMAKE_CXX_COMPILER_ID is not an environment variable.

I don't see "CXX_COMPILER" anything in my CMakerLists.txt

cvmiller@maker:~/nedit-ng$ grep CXX CMakeLists.txt 
        LANGUAGES CXX 

Yet, when I look at the release CMakerLists.txt there are lots of entries:

cvmiller@maker:~/nedit-ng-2020.1$ grep CXX CMakeLists.txt 
project(nedit CXX)
                add_definitions(-D_GLIBCXX_DEBUG)
                add_definitions(-D_GLIBCXX_DEBUG_PEDANTIC)
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -pg -no-pie")
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -fsanitize=address") # -fsanitize-address-use-after-scope
                add_definitions(-D_GLIBCXX_SANITIZE_VECTOR)
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -fsanitize=undefined")
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -fsanitize=thread")
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -fsanitize=memory")
                set(CMAKE_CXX_FLAGS        "${CMAKE_CXX_FLAGS}        -flto")

My machine is a Linux Container running Debian/10 running on a Chromebook using the Crostini VM (Google runs a VM, and then Linux Containers inside the VM to provide Linux for Chromebook users).

I assume it is using g++ for the c++ code

cvmiller@maker:~/nedit-ng-2020.1$ which g++
/usr/bin/g++
cvmiller@maker:~/nedit-ng-2020.1$ which gcc
/usr/bin/gcc

As I mentioned, I was able to get the release 2020.1 to compile just fine without any CXX_Compiler problems on this Linux Container. The only difference is one directory is the 2020.1 release, and the other I did a git clone from github.

eteran commented 2 years ago

Oh, to be clear, it's not an environment variable, it's a cmake variable that is supposed to set by cmake itself. The really puzzling thing is that the 2020.1 release actually uses the same code to detect the compiler!

https://github.com/eteran/nedit-ng/blob/2020.1/cmake/Modules/DetectCompiler.cmake

Out of curiosity, since it's a chomebook, is it an arm machine? I can certainly create a debian 10 docker container to try to replicate your build envionrment... but it would be x86-64 for me, so I'm not sure it would help.

One thing I can do is simply make the unsupported compiler a warning and have it assume gcc from there :shrug:

Can you try doing this:

$ git checkout assume-gcc 

and then trying cmake again to see if it's happt?

eteran commented 2 years ago

Oh Also, can you show the whole cmake output as well, just in case there's something in there that stands out for me.

cvmiller commented 2 years ago

After git checkout assume-gcc I see:

cvmiller@maker:~/nedit-ng/build$ cmake ..
CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/AddWarnings.cmake:2 (include)
  CMakeLists.txt:10 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  cmake/Modules/AddWarnings.cmake:2 (include)
  CMakeLists.txt:10 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  CMakeLists.txt:11 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  CMakeLists.txt:11 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/EnableSanitizers.cmake:2 (include)
  CMakeLists.txt:13 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  cmake/Modules/EnableSanitizers.cmake:2 (include)
  CMakeLists.txt:13 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/EnableSTLDebug.cmake:2 (include)
  CMakeLists.txt:14 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  cmake/Modules/EnableSTLDebug.cmake:2 (include)
  CMakeLists.txt:14 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/Profiling.cmake:1 (include)
  CMakeLists.txt:15 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  cmake/Modules/Profiling.cmake:1 (include)
  CMakeLists.txt:15 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:9 (message):
  Unsupported Compiler:
Call Stack (most recent call first):
  cmake/Modules/ProjectDefaults.cmake:2 (include)
  CMakeLists.txt:16 (include)

CMake Warning at cmake/Modules/DetectCompiler.cmake:10 (message):
  Will continue configuration assuming GCC
Call Stack (most recent call first):
  cmake/Modules/ProjectDefaults.cmake:2 (include)
  CMakeLists.txt:16 (include)

-- Boost version: 1.67.0
CMake Error at Util/CMakeLists.txt:3 (find_package):
  By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5" (requested
  version 5.5.0) with any of the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!
See also "/home/cvmiller/nedit-ng/build/CMakeFiles/CMakeOutput.log".
See also "/home/cvmiller/nedit-ng/build/CMakeFiles/CMakeError.log".
cvmiller@maker:~/nedit-ng/build$ 

Oddly enough, I have Qt5 installed on this container, as I built the release 2020.1 on this same container without complaint about Qt5.

Yes, this is an ARM Chromebook (Asus C101PA), running aarch64 architecture.

I think making the CXX_Compiler a warning and assuming gcc would be a good work-around.

eteran commented 2 years ago

Well, it didn't seem to be a good enough work around since things still failed to build! (the branch I had you check out did exactly that).

Can you do me a favor and try building 2020.1 again? Because it looks like your build environment may have an issue.

Also if possible, please include the whole cmake log starting from the begining. Not just where the errors start.

cvmiller commented 2 years ago

I ran cmake .. in 2020.1 again, and it completes with out error (see attached log rel_2020.1_CMakeOutput.log).

And I have also attached the cmake logs for the assume-gcc branch

cvmiller commented 2 years ago

attaching files CMakeOutput.log CMakeError.log rel_2020.1_CMakeOutput.log

eteran commented 2 years ago

OK, that helps. But can you also include the literal console output of the cmake command from start to finish in a fresh build directory. It should look something like this:

$ cmake ..
-- The CXX compiler identification is GNU 11.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /usr/lib64/cmake/Boost-1.76.0/BoostConfig.cmake (found suitable version "1.76.0", minimum required is "1.35")  
-- Extracting nedit-ng version info with git...
-- Found Git: /usr/bin/git (found version "2.32.0") 
-- NEDIT_VERSION_GIT = "2020.1-215-g25373dc9-dirty"
-- NEDIT_COMMIT_GIT = "25373dc9f20fe66ed7ff8504b1e357f4952a5db0"
-- NEDIT_BRANCH_GIT = "master"
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eteran/projects/nedit-ng/build

Please try deleting the build directory, recreating it and doing a cmake from scratch. I'd like to see if there are any telling messages in there because the CMakeError.log seems to indicate that it simply isn't finding your compiler at all.

If you could do this with both master and 2020.1, that would help a lot in tracking this down.

eteran commented 2 years ago

It's also interesting that the log output for 2020.1 and master are different in unexpected ways, like this:

Master:

The system is: Linux - 5.4.151-16906-g86cbb761e8c4 - aarch64
Determining if the CXX compiler works passed with the following output:
Change Dir: /home/cvmiller/nedit-ng/build/CMakeFiles/CMakeTmp

vs

2020.1:

The system is: Linux - 5.4.151-16906-g86cbb761e8c4 - aarch64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/c++ 
Build flags: 
Id flags:  

The output was:
0

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is GNU, found in "/home/cvmiller/nedit-ng-2020.1/build/CMakeFiles/3.13.4/CompilerIdCXX/a.out"

Determining if the CXX compiler works passed with the following output:
Change Dir: /home/cvmiller/nedit-ng-2020.1/build/CMakeFiles/CMakeTmp

Notice how in the 2020.1, cmake does compilerId stuff that we don't see in the 2020.1 build.

cvmiller commented 2 years ago

Thanks for your patience. I think I found the issue in the last bit of removing the build dir, and re-running cmake. When I tried to remove the build dir I got this:

cvmiller@maker:~/nedit-ng$ rm -rf build
rm: cannot remove 'build/CMakeFiles/3.13.4/CompilerIdCXX/tmp': Permission denied

I had to elevate to root to get rid of that directory. I suspect in the early days of me trying to get all the required packages, I tired to run cmake as root (in that directory) and it must have created directories that my normal user couldn't delete, or remove.

After removing that directory, and re-creating the build dir, (in the assume-gcc branch), I see a good run of cmake:

cvmiller@maker:~/nedit-ng/build$ cmake .. | tee ~/maste_cmake.txt
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.67.0
-- Extracting nedit-ng version info with git...
-- Found Git: /usr/bin/git (found version "2.20.1") 
-- NEDIT_VERSION_GIT = "2020.1-215-ged455d7d"
-- NEDIT_COMMIT_GIT = "ed455d7d8d4a5a12f073a95d4b6e5f6494cc5f84"
-- NEDIT_BRANCH_GIT = "assume-gcc"
-- Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/aarch64-linux-gnu/libX11.so;/usr/lib/aarch64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/aarch64-linux-gnu/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cvmiller/nedit-ng/build
cvmiller@maker:~/nedit-ng/build$ 

I switched to master (git checkout master) and deleted the build dir, recreated build dir, and re-ran cmake again, and the output is the same as above. It works!

Sorry to trouble you with this. Clearly the problem was on my end with files/directories created by root. My bad.

Thanks again for porting nedit-ng to Qt5. I use it every day. Closing this issue.

eteran commented 2 years ago

Nice, glad we got to the bottom of it!

cvmiller commented 2 years ago

Yes, thanks for all your help.