There was a question, there is a task to change the source code of the showkey utility in Linux, in the -k mode, it has a shutdown feature after the user has not entered characters from the keyboard for 10 seconds, there is a need to turn off the utility’s work on the Enter key, for this the source code was downloaded There are libraries that are not standard, then the Internet break found these libraries on the site:
https://fossies.org/dox/kbd-2.0.4/getfd_8h_source.html

Showkey utility source code:
https://kernel.googlesource.com/pub/scm/linux/kernel/ ..

After adding libraries: version.h , getfd.h , nls.h , config.h , kbd.h

A compilation attempt was made, and the following errors were received: enter image description here

  • 1. $ dpkg -S $(which showkey) 2. by analogy - aleksandr barakin
  • A compilation attempt was made - how? Did you run configure ? Did the build make make ? Questions arose because (most likely) you have no build mode. - Sergey

1 answer 1

How to patch any program from the debian-core distribution repository?

  1. you need to know which package the program is in:

     $ dpkg -S $(which имя-ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡ‹) 
  2. you need to install the source and build dependencies of the package.

    1. First, uncomment the source package entries in /etc/apt/sources.list :

       $ sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list 
    2. update the package list:

       $ sudo apt-get update 
    3. install the build dependencies:

       $ sudo apt-get build-dep имя-ΠΏΠ°ΠΊΠ΅Ρ‚Π° 
    4. Create a new directory with an arbitrary name somewhere in your home directory and make it current:

       $ mkdir ~/build.the.source && cd ~/build.the.source 
    5. Download and unpack the source package:

       $ apt-get source имя-ΠΏΠ°ΠΊΠ΅Ρ‚Π° 
  3. make the necessary changes:

     $ cd ~/build.the.source/имя-ΠΏΠ°ΠΊΠ΅Ρ‚Π°-вСрсия-ΠΏΠ°ΠΊΠ΅Ρ‚Π° $ edit ... 
  4. create a patch:

     $ dpkg-source --commit 
  5. build the fixed version of the package:

     $ dpkg-buildpackage -uc -us 

if the build was successful, the package file is one directory higher - in ~/build.the.source . You can unpack and configure it, as usual, with the dpkg program:

 $ sudo dpkg -i ~/build.the.source/xyz.deb 
  • The problem is still there: sudo dpkg -i ~/build.the.source/xyz.deb after this command does not see the gcc header files, and if you write the path C_INCLUDE_PATH the same error as before - Ilya
  • what have gcc to do when installing the package? did you collect it? instead of xyz.deb, you need to substitute the actual name of the collected file with the package. - aleksandr barakin
  • completed all the described actions, then we try to compile the file with the showkey.c utility source code, the compiler says that there are no libraries - Ilya
  • completed all the described actions - in the fifth paragraph, the program (s) / libraries (s) are compiled and packaged. nothing else to compile. - aleksandr barakin