Linux build and install - but not as root (broken)

54 views
Skip to first unread message

William Douglas

unread,
Jan 22, 2023, 7:42:10 PM1/22/23
to KiCad Developers
Just tried compiling the latest version of KiCad direct from source.  For the "INSTALL_PREFIX" I specified a directory within my home directory.  This was to prevent the new build from impacting my system.

After building I attempted to install as the current user.  This should be fine but it turned out to have problems.  Looks like "/usr/local/share/kicad/resources" is being written to despite the newly provided installation prefix.  Here is the result:

-- Installing: /home/william/Applications/kicad/share/applications/org.kicad.pcbnew.desktop
-- Installing: /home/william/Applications/kicad/share/applications/org.kicad.bitmap2component.desktop
-- Installing: /home/william/Applications/kicad/share/metainfo
-- Installing: /home/william/Applications/kicad/share/metainfo/org.kicad.kicad.metainfo.xml
CMake Error at resources/bitmaps_png/cmake_install.cmake:54 (file):
file cannot create directory: /usr/local/share/kicad/resources. Maybe need
administrative privileges.
Call Stack (most recent call first):
resources/cmake_install.cmake:63 (include)
cmake_install.cmake:57 (include)


FAILED: CMakeFiles/install.util
cd /home/william/Source/kicad/build/release && /usr/bin/cmake -P cmake_install.cmake

ninja: build stopped: subcommand failed.

It mostly works, but not all portions of the install script adhere to the requested install prefix.  I used the build command:

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/home/william/Applications/kicad -G Ninja ../../

Performing a build / install into a user home folder should not require superuser privileges.  If there was a good reason then fine, but this error looks like an oversight so I thought I should make note of it here.

Thanks for the great software,
William

Steven A. Falco

unread,
Jan 23, 2023, 10:53:08 AM1/23/23
to dev...@kicad.org
There are some additional variables that might be helpful. For Fedora's nightly builds, which have to be installed into other than the system directories, we use the following, where the "%{foo}" stuff refers to macros, but you should be able to substitute your desired paths:

cmake \
-DKICAD_SCRIPTING_WXPYTHON=ON \
-DKICAD_USE_OCC=ON \
-DKICAD_INSTALL_DEMOS=ON \
-DKICAD_BUILD_QA_TESTS=OFF \
-DKICAD_SPICE=ON \
-DKICAD_BUILD_I18N=ON \
-DKICAD_I18N_UNIX_STRICT_PATH=ON \
-DKICAD_USE_EGL=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{kicad_prefix} \
-DCMAKE_INSTALL_DATADIR=%{_datadir} \
-DCMAKE_INSTALL_DOCDIR=%{_docdir} \
-DDEFAULT_INSTALL_PATH=%{kicad_prefix} \
-DKICAD_DATA=%{_datadir}/%{name} \
-DKICAD_DOCS=%{_docdir}/%{name} \
-DPYTHON_SITE_PACKAGE_PATH=%{kicad_python_path}

Steve


Steven A. Falco

unread,
Jan 23, 2023, 11:03:07 AM1/23/23
to dev...@kicad.org
Another thing that might help is the attached script. I use it to make test builds of KiCad, and it doesn't require any special privileges. Just do a git clone, then make a build subdirectory, and run the script like so:

git clone https://gitlab.com/kicad/code/kicad.git
cd kicad
mkdir build-master
cd build-master
build_kicad

The script will then tell you how to set up your LD_LIBRARY_PATH variable to run the build. Note that on Fedora we use /lib64, but other distros may do that differently, so you may have to tweak the script a little.

Steve
build_kicad

William Douglas

unread,
Jan 23, 2023, 12:58:18 PM1/23/23
to KiCad Developers, steve...@gmail.com
Thanks, I will give it a try.

I still believe the '-DCMAKE_INSTALL_PREFIX=' setting should behave as expected. When I executed the compiled kicad, the GUI opened but then failed because it was searching for images in the /usr/local/... directory.  This is just wrong.

That being said, it is a very minor issue which will not impact many people.  And if there is a workaround then it is even less important.  Perhaps if I have some free time.....

Many thanks to the KiCad community for all that everyone has done.
William

Johannes Maibaum

unread,
Jan 23, 2023, 1:26:20 PM1/23/23
to dev...@kicad.org
Hi William,

Am Montag, dem 23.01.2023 um 09:58 -0800 schrieb William Douglas:
> That being said, it is a very minor issue which will not impact many
> people.  And if there is a workaround then it is even less important. 
> Perhaps if I have some free time.....

While the devlist is great for quickly double-checking things like you
did, it seems to me that you have found a bug. The KiCad project tracks
bugs over at https://gitlab.com/kicad/code/kicad/-/issues . If you want
to increase the chance that someone who knows their way around the KiCad
codebase and the CMake config will look at it it their free time, I
suggest to file a ticket over there.

Otherwise it might just get lost.


Cheers,
Johannes

Andrew Lutsenko

unread,
Jan 23, 2023, 1:44:45 PM1/23/23
to dev...@kicad.org
Hello,

I don't think there is a bug. Some paths are calculated based on install prefix and cached. If you change the install prefix you should clean cmake cache before build.


Best,
Andrew

--
You received this message because you are subscribed to the Google Groups "KiCad Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to devlist+u...@kicad.org.
To view this discussion on the web visit https://groups.google.com/a/kicad.org/d/msgid/devlist/ba08aa7b-2cc4-4a41-ac29-ae4ea7c112dfn%40kicad.org.

William Douglas

unread,
Jan 23, 2023, 2:11:47 PM1/23/23
to KiCad Developers, anlut...@gmail.com
Andrew is correct.  Many thanks.
Reply all
Reply to author
Forward
0 new messages