Embarassed but must seek help

Hello!

Started a HelloWorld project for the 1st time with KDevelop. The Build command resulted in the following output:

/home/reza/projects/kde/HelloWorld/build> /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -G Ninja /home/reza/projects/kde/HelloWorld
/usr/bin/cmake: symbol lookup error: /lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol: nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation
*** Failure: Exit code 127 ***

The check on libcurl shows:

$ ldconfig -p | grep libcurl
	libcurl.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcurl.so.4
	libcurl-gnutls.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcurl-gnutls.so.4

And CMakeLists.txt is:

cmake_minimum_required(VERSION 3.0)

project(helloworld LANGUAGES C)
project(nghttp2 VERSION 1.50.0)

add_executable(helloworld main.c)

install(TARGETS helloworld RUNTIME DESTINATION bin)

and the default main.c is:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    puts("Hello, World!");
    return 0;
}

I’m using KDevelop version 5.12.230804.

What changes are needed to Build without errors? Thanks.

Regards.

Embarassed but must seek help

Don’t be! :slight_smile:

Do you have the libnghttp2 library installed? What’s the output of the following?

ldd /lib/x86_64-linux-gnu/libcurl.so.4

BTW: not sure why you need the project(nghttp2 VERSION 1.50.0) line in your CMakeLists.txt file

Hello @jsalatas,

Here is the command output per your suggestion:

$ ldconfig -p | grep libcurl
	libcurl.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcurl.so.4
	libcurl-gnutls.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcurl-gnutls.so.4
(base) reza@BeUlta:~/projects$ ldd /lib/x86_64-linux-gnu/libcurl.so.4
	linux-vdso.so.1 (0x00007fffa03e7000)
	libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007fe05031e000)
	libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007fe0502d2000)
	librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007fe0502b3000)
	libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007fe050242000)
	libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007fe05022e000)
	libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007fe050187000)
	libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007fe04fc00000)
	libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fe050133000)
	libldap.so.2 => /lib/x86_64-linux-gnu/libldap.so.2 (0x00007fe04fba2000)
	liblber.so.2 => /lib/x86_64-linux-gnu/liblber.so.2 (0x00007fe050123000)
	libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fe04faeb000)
	libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007fe050114000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe04facc000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe04f800000)
	libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007fe04f64c000)
	libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007fe04f456000)
	libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007fe04fa83000)
	libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007fe04fa2e000)
	libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fe04f3d1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe05041f000)
	libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fe04f308000)
	libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fe04f2dc000)
	libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fe05010c000)
	libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fe04fa21000)
	libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007fe04f2c2000)
	libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007fe04f29f000)
	libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fe04f101000)
	libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fe04f0ea000)
	libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fe050101000)
	libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fe04fa0f000)
	libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007fe04f0df000)
$

BTW: not sure why you need the project(nghttp2 VERSION 1.50.0) line in your CMakeLists.txt file

You are correct! That statement makes no difference to the error message. I was simply trying out a suggested resolution from the GitHub nghttp2 repository but presumably it had nothing to do with my error message.

I must have libnghttp2 installed owing to the following output:

$ ldconfig -p | grep libnghttp2
	libnghttp2.so.14 (libc6,x86-64) => /lib/x86_64-linux-gnu/libnghttp2.so.14

Thanks for your continuing guidance.

Regards.

So now it’s my turn to ask a stupid question: what does the -G Ninja directive do? In my system (KDE Neon) it seems like cmake is failing with that directive (in a different way than yours), however running the following

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug ..

I get no errors and I’m able to compile the example

Edit: I had to install ninja build. After installing it the command

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -G Ninja ..

works as expected and I can compile the example without issues. I’m not sure what’s missing in your system. What is your distro btw?

/home/reza/projects/kde/HelloWorld/build> /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -G Ninja /home/reza/projects/kde/HelloWorld
/usr/bin/cmake: symbol lookup error: /lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol: nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation
*** Failure: Exit code 127 ***

I don’t believe this error is related to your CMake project at all. It seems that your cmake executable is using libcurl for some functionality internally, so it loads libcurl’s shared object, but on your distro the shared object can’t be loaded. So the whole thing crashes before it even executes much code to begin with.

It looks like your libcurl was built (presumably by your distro) against a version of nghttp2 that provided the nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation function. But now the nghttp2 library was swapped out for a version that does not provide this function, so libcurl won’t load. Presumably this would break a lot more software on your system than just CMake.

Now, given that your CMakeLists.txt contains some sort of reference to nghttp2, I have to ask: did you install a different version of nghttp2 that replaced the original one by your distro?

Hello,

All I want to do is to build a Hello World project (in C/C++). I did not create the original source file, main.c, nor the CMakeLists.txt file. These were generated by the “wizard” while I attempted to create my first project.

If nghttp2 is broken in my platform (owing to my self-inflicted ignorance), how do I recover? Same request for help with libcurl. I don’t use these libraries explicitly, so the libraries got messed up during the installation of some package. Simply re-install? I need KDevelop to work and can sort out issues with other packages (e.g. Kdenlive) if anything outside of KDevelop breaks.

How do I put Humpty Dumpty back together again? Thanks.

Regards.

Ninja is a build system that I avoid. I didn’t explicitly enter the command to include it. I am surprised that it shows up.

I can run make for my example without issues for this trivial example. Your example will work, undoubtedly. Let me try ccmake and step through the other parameters, if any. Thanks.

Regards.

Hello @jsalatas,

I fail to understand why I can use cmake & make from the command line and successfully build the program yet when I use the KDevelop IDE to do something similar, extraneous parameters are being applied.

Are you aware of any edit that I can perform to remove the superfluous parameters? Thanks.

Regards.

P.S.
I reinstalled libcurl-dev and nghttp2 but that didn’t resolve the issue.

I’m afraid I have no idea what the issue might be. Sorry about that :frowning:

As @jpetso mentioned it seems that there may be issues with your installation/distro.

Thanks, @jsalatas! I will try another platform with a clean slate. It would be an arm64 environment rather than the amd64 which is my primary dev environment.

Regards.

Ok, I think I know a root cause.
The issue is related the only to a SNAP package.
When you are running a cmake command from the command line you are using you OS/system environment and set of libs. But when snapped KDevelop does that it runs command from isolated environment. Thus, I think libnghttp2-14 is not a part of the snap package vfs, and thus cmake is not able to find this lib.

1 Like

Thanks, @jetty.

I still don’t understand how to configure (or rather override) the automatic inclusion of the directive for a specific build package (either Ninja or CMake) in my original installation of KDevelop. The default was Ninja (how & where beats me) but using a documented environment variable I could change it to CMake. And as you perhaps rightly pointed out, the snap environment conflict persisted.

My workaround was to uninstall KDevelop and use the AppImage version. In this mode neither Ninja nor CMake are explicitly invoked and the build proceeds successfully. Of course, in this mode, updates to KDevelop are manual, but that is the least of my worries since I have a lot to learn with whatever is working.

I need a crash course on KDevelop. Any suggestions, please?

KDevelop will build my simple OpenCV (read and display) test, but upon launching the executable, there is no display window for the test image. Yet, running the same executable from the command line, works perfectly as expected (i.e. display window pops up).

Thanks again.

Regards.

So the build system is being selected upon importing/creating of the project. IF you selected a file (to import) CMakeLists.txt than build system would be CMake.
The other thing is generator which cmake uses to produce actual build rules, and by default it is makefiles (you can change that either by specifying extra command line options or via kdev project file)