You are not logged in.

#1 2021-11-10 21:00:22

Automath
Member
Registered: 2016-05-16
Posts: 115

Error while installing drivers for my printer

The driver for my printer is this: https://aur.archlinux.org/packages/cnijfilter-mp250/ so git cloned it and then cd and makepkg, but it seems that there's something bad in the source, precisely it seems to be a language deprecation issue:

Here is part of the makepkg compiling output:

      |                          ^~~~~~~~~~~~~~~~~~
bjcups.c:692:25: error: invalid use of incomplete typedef 'ipp_t' {aka 'struct _ipp_s'}
  692 |                 pRequest->request.op.operation_id = CUPS_GET_PRINTERS;
      |                         ^~
bjcups.c:693:25: error: invalid use of incomplete typedef 'ipp_t' {aka 'struct _ipp_s'}
  693 |                 pRequest->request.op.request_id   = 1;
      |                         ^~
bjcups.c:702:38: error: invalid use of incomplete typedef 'ipp_t' {aka 'struct _ipp_s'}
  702 |                         if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
      |                                      ^~
bjcups.c:707:55: error: invalid use of incomplete typedef 'ipp_t' {aka 'struct _ipp_s'}
  707 |                                 pAttribute = pResponse->attrs;
      |                                                       ^~
bjcups.c:710:80: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  710 |                                         while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) {
      |                                                                                ^~
bjcups.c:711:72: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  711 |                                                 pAttribute = pAttribute->next;
      |                                                                        ^~
bjcups.c:717:80: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  717 |                                         while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) {
      |                                                                                ^~
bjcups.c:718:70: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  718 |                                                 if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
      |                                                                      ^~
bjcups.c:718:112: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  718 |                                                 if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
      |                                                                                                                ^~
bjcups.c:719:78: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  719 |                                                         pPrinter = pAttribute->values[0].string.text;
      |                                                                              ^~
bjcups.c:721:70: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  721 |                                                 if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
      |                                                                      ^~
bjcups.c:721:110: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  721 |                                                 if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
      |                                                                                                              ^~
bjcups.c:722:75: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  722 |                                                         pDUri = pAttribute->values[0].string.text;
      |                                                                           ^~
bjcups.c:724:72: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  724 |                                                 pAttribute = pAttribute->next;
      |                                                                        ^~
bjcups.c:733:73: error: invalid use of incomplete typedef 'ipp_attribute_t' {aka 'struct _ipp_attribute_s'}
  733 |                                                  pAttribute = pAttribute->next;
      |                                                                         ^~
bjcups.c: In function 'main':
bjcups.c:830:17: warning: 'cupsGetPPD' is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
  830 |                 p_ppd_name = cupsGetPPD( g_printer_name );
      |                 ^~~~~~~~~~
In file included from bjcups.c:27:

I know that it is a very old printer but it still works, it's the only one that I have, and I don't want to dump it. any help?


Edit: it seems to be a solution as described on this comment: https://bbs.archlinux.org/viewtopic.php … 7#p1972667 (the same was posted on the aur page comments)

PowaBanga wrote:

So i Add this sed commands in "prepare"

  sed -i 's/char                   \*pPrinter = NULL;                      \/\/ Pointer to printer name\./const char               \*pPrinter = NULL;                      \/\/ Pointer to printer name\./g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/char			\*pDUri = NULL;				\/\/ Pointer to Device uri\./const char		\*pDUri = NULL;				\/\/ Pointer to Device uri\./g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pRequest->request\.op\.operation_id = CUPS_GET_PRINTERS;/ippSetOperation(pRequest, CUPS_GET_PRINTERS);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pRequest->request\.op\.request_id   = 1;/ippSetRequestId(pRequest, 1);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/if (pResponse->request\.status\.status_code > IPP_OK_CONFLICT) {/if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pAttribute = pResponse->attrs;/pAttribute = ippFirstAttribute(pResponse);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pAttribute->group_tag/ippGetGroupTag(pAttribute)/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pAttribute = pAttribute->next;/pAttribute = ippNextAttribute(pResponse);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/strcmp(pAttribute->name/strcmp(ippGetName(pAttribute)/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pAttribute->value_tag/ippGetValueTag(pAttribute)/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pPrinter = pAttribute->values\[0\]\.string\.text;/pPrinter = ippGetString(pAttribute, 0, NULL);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/pDUri = pAttribute->values\[0\]\.string\.text;/pDUri = ippGetString(pAttribute, 0, NULL);/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/bjcups.c
  sed -i 's/size_t len;/socklen_t len;/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij/cngpij/getipc.c
  sed -i 's/sys\/sysctl.h/linux\/sysctl.h/g' ${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpijmon/cnijnpr/cnijnpr/cnijnpr.c
   

and now the compilation work ! 50% solved ! yeah ! Thank-you loqs ! (not tested yet on my mp250 scanner, it is not near me)

Now I have to fix the remaining 50%  smile

however I have no clue what the mentioned "prepare" file should be. Please isn't it time to fix this package from once and at all?

Edit solved! @loqs I love you! sorry for my effusivity.
the complete solution is as follows: to install cnijfilter-mp250 first clone the obsene package:

git clone https://aur.archlinux.org/cnijfilter-mp250.git
cd cnijfilter-mp250
git reset --hard
curl -o temp.patch http://ix.io/3mF7 #Download the patch from post #4 please check it before applying
git apply -v temp.patch
rm temp.patch
sed -i 's/test.patch/ipp.patch/g'  PKGBUILD
makepkg -si

and worked! Anyway you should patch this package at the aur as I said.

Last edited by Automath (2021-11-11 21:08:59)

Offline

#2 2021-11-10 21:08:51

loqs
Member
Registered: 2014-03-06
Posts: 18,996

Re: Error while installing drivers for my printer

Offline

#3 2021-11-11 19:20:15

Automath
Member
Registered: 2016-05-16
Posts: 115

Re: Error while installing drivers for my printer

That answer is somewhat complex, though I preciate your disposition and understand your econonomy of words.

Do you mean this:

loqs wrote:
git reset --hard
curl -o temp.patch http://ix.io/3mF7 #Download the patch from post #4 please check it before applying
git apply -v temp.patch
rm temp.patch

It should then compile.

https://bbs.archlinux.org/viewtopic.php … 0#p1972670

well I done as you said...

git apply -v temp.patch
temp.patch:65: space before tab in indent.
 	else {
temp.patch:66: space before tab in indent.
 		pRequest = ippNew();
temp.patch:67: trailing whitespace.
 		
temp.patch:72: trailing whitespace.
 		
temp.patch:73: space before tab in indent.
 		pLanguage = bjcupsLangDefault();	// cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
Checking patch PKGBUILD...
Checking patch fix.patch...
Checking patch ipp.patch...
Applied patch PKGBUILD cleanly.
Applied patch fix.patch cleanly.
Applied patch ipp.patch cleanly.
warning: squelched 27 whitespace errors
warning: 32 lines add whitespace errors.

and:

makepkg -si
==> Making package: cnijfilter-mp250 3.40.1-5.1 (Thu Nov 11 16:48:44 2021)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading cnijfilter-source-3.40-1.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9362k  100 9362k    0     0  7593k      0  0:00:01  0:00:01 --:--:-- 7599k
  -> Found fix.patch
  -> Found libpng.patch
  -> Found automake_fix.patch
==> ERROR: test.patch was not found in the build directory and is not a URL.

@loqs I was just about to install the comercial package via debtap indeed I just installed pkgfile.
~~@loqs so what exactly i am supposed to do? should I clone the package, then make -si , then follow your steps and makepkg -si again?~~
@loqs solved! I love you!

Last edited by Automath (2021-11-11 20:57:19)

Offline

#4 2021-11-11 20:22:06

loqs
Member
Registered: 2014-03-06
Posts: 18,996

Re: Error while installing drivers for my printer

In http://ix.io/3mF7 I forgot to rename test.patch to ipp.patch in the sources array on line 52 of the PKGBUILD.
With that change it should build.  As I do not have the printer that is as far as I can test it.

Offline

Board footer

Powered by FluxBB