kicad needs curl unconditionally

Bug #1791500 reported by Fabio Rossi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
Fabio Rossi

Bug Description

In the actual CMakeLists.txt file curl is required only conditionally based on the option BUILD_GITHUB_PLUGIN. Actually this is wrong because the static common library defined in common/CMakeLists.txt depends on kicad_curl/kicad_curl.cpp which requires curl even if BUILD_GITHUB_PLUGIN is not defined.

This is the error I get without curl installed with -DBUILD_GITHUB_PLUGIN=NO:

[ 59%] Building CXX object common/CMakeFiles/common.dir/kicad_curl/kicad_curl.cpp.o
cd /var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999_build/common && /usr/bin/x86_64-pc-linux-gnu-g++ -DGLM_FORCE_CTOR_INIT -DHAVE_STDINT_H -DKICAD_SCRIPTING -DKICAD_SCRIPTING_ACTION_MENU -DKICAD_SCRIPTING_MODULES -DKICAD_SCRIPTING_WXPYTHON -DKICAD_SPICE -DKICAD_USE_OCC -DUSE_OPENMP -DWXUSINGDLL -DWX_COMPATIBILITY -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/include -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/. -isystem /usr/lib64/wx/include/gtk2-unicode-3.0 -isystem /usr/include/wx-3.0 -isystem /usr/lib64/opencascade-7.3.0/ros/lin/inc -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/./dialogs -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/./widgets -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/./dialog_about -I/usr/include/cairo -I/usr/include/pixman-1 -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/../3d-viewer -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/../pcbnew -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/../polygon -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999_build -I/usr/include/python2.7 -I/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/scripting -DNDEBUG -DNDEBUG -Wall -O2 -pipe -march=corei7 -ggdb -Wsuggest-override -Wno-unused-local-typedefs -Wno-strict-aliasing -fopenmp -pthread -Wshadow -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -std=gnu++11 -o CMakeFiles/common.dir/kicad_curl/kicad_curl.cpp.o -c /var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/kicad_curl/kicad_curl.cpp
In file included from /var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/common/kicad_curl/kicad_curl.cpp:28:0:
/var/tmp/portage/sci-electronics/kicad-9999/work/kicad-9999/include/kicad_curl/kicad_curl.h:44:23: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>
                       ^
compilation terminated.
make[2]: *** [common/CMakeFiles/common.dir/build.make:3792: common/CMakeFiles/common.dir/kicad_curl/kicad_curl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

I have attached a simple fix for the problem.

Revision history for this message
Fabio Rossi (rossi-f) wrote :

using git format-patch for the proposed patch

Revision history for this message
Seth Hillbrand (sethh) wrote :

Do we use curl for other things? Is there are reason to keep it compiling when the github plugin is off?

Revision history for this message
Fabio Rossi (rossi-f) wrote :

With or without the patch the result is always the same, curl is always compiled with kicad even with -DBUILD_GITHUB_PLUGIN=NO.

Looking into the CMakeLists.txt, curl is compiled into an intermediate static library in common/CMakeLists.txt, look at

add_library( common STATIC ${COMMON_SRCS} )

where among ${COMMON_SRCS} there is kicad_curl/kicad_curl.cpp which includes <curl/curl.h> from kicad_curl/kicad_curl.h. This happens unconditionally even if find_package( CURL REQUIRED ) is not executed.

The static library "common" is later linked in many other modules/libraries by the build system, even with the github plugin off.

What changes with the patch is that the user compiling the sources discovers the problem already during the configuration phase. Right now you will never see a dynamic dependency on curl for the shared libraries installed by kicad because curl is built as static.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

kicad_curl is only used by the github plugin so both the github plugin and kicad_curl could be conditionally built depending on BUILD_GITHUB_PLUGIN.

Revision history for this message
Fabio Rossi (rossi-f) wrote :

thank you for the hint, I have then accordingly created a new patch here attached

Revision history for this message
Seth Hillbrand (sethh) wrote :

Fix commited in 21485e6f2

Thank you for your contribution to KiCad

Changed in kicad:
assignee: nobody → Fabio Rossi (rossi-f)
status: New → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.