michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
307 stars 49 forks source link

pappl build errors: on linux, missing #defines, libcups3 not found #350

Closed pgnd closed 1 week ago

pgnd commented 6 months ago

i'm working on a snap-less pkg build of hplip-printer-app.

the pappl prereq hits some build fails

for src

git clone https://github.com/michaelrsweet/pappl
cd pappl
git log -n1
    commit 988b90a7bf9dab4c77c34ea30e3a657376686079 (HEAD -> master, origin/master, origin/HEAD)
    Merge: 528bd54 6dd1e72
    Author: Michael R Sweet <michael.r.sweet@gmail.com>
    Date:   Wed Feb 21 11:14:21 2024 -0500

        Merge pull request #342 from zdohnal/client-auth-fail

        client-auth.c: Fix authentication denial for valid logins

there are a number of undefs,

./configure
make
    ...
    Compiling mainloop-subcommands.c...
    mainloop-subcommands.c: In function ‘_papplMainloopRunServer’:
    mainloop-subcommands.c:704:46: error: ‘PAPPL_STATEDIR’ undeclared (first use in this function)
      704 |       snprintf(statename, sizeof(statename), PAPPL_STATEDIR "/lib/%s.state", base_name);
          |                                              ^~~~~~~~~~~~~~
    ...
    mainloop-support.c: In function ‘_papplMainloopGetServerPath’:
    mainloop-support.c:596:31: error: ‘PAPPL_SOCKDIR’ undeclared (first use in this function); did you mean ‘PAPPL_STATEDIR’?
      596 |     snprintf(buffer, bufsize, PAPPL_SOCKDIR "/%s.sock", base_name);
          |                               ^~~~~~~~~~~~~
    ...
    Compiling system.c...
    system.c: In function ‘papplSystemRun’:
    system.c:515:52: error: expected ‘)’ before ‘PAPPL_VERSION’
      515 |     snprintf(header, sizeof(header), "%s/%s PAPPL/" PAPPL_VERSION " CUPS IPP/2.0", safe_name, system->versions[0].sversion);
          |             ~                                      ^~~~~~~~~~~~~~
    ...

adding

pappl/system-private.h

+   # define PAPPL_VERSION "2.0b1"
+   # define PAPPL_STATEDIR
+   # define PAPPL_SOCKDIR

    #ifndef _PAPPL_SYSTEM_PRIVATE_H_

kludges around the undefs,

make
    ...
    Compiling util.c...
    Linking libpappl2.so.2...
    /usr/bin/ld: cannot find -lcups3: No such file or directory
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:215: libpappl2.so.2] Error 1
    make[1]: Leaving directory '/builddir/build/BUILD/work/pappl/pappl'
    make: *** [Makefile:28: all] Error 1
    <mock-chroot> sh-5.2#

, which is a different issue, as

echo $LDFLAGS
    -L/builddir/build/BUILD/work/libcups/cups -L/builddir/build/BUILD/work/cups/cups

ls -al /builddir/build/BUILD/work/libcups/cups/libcups3*
    -rw-r--r-- 1 mockbuild mock 4834926 Mar 10 16:17 /builddir/build/BUILD/work/libcups/cups/libcups3.a
    -rw-r--r-- 1 mockbuild mock    8869 Mar 10 16:16 /builddir/build/BUILD/work/libcups/cups/libcups3.def
    -rw-r--r-- 1 mockbuild mock    1954 Mar 10 16:16 /builddir/build/BUILD/work/libcups/cups/libcups3.rc
    lrwxrwxrwx 1 mockbuild mock      13 Mar 10 16:17 /builddir/build/BUILD/work/libcups/cups/libcups3.so -> libcups3.so.3
    -rwxr-xr-x 1 mockbuild mock 3264784 Mar 10 16:17 /builddir/build/BUILD/work/libcups/cups/libcups3.so.3

not clear to me, yet, why lib's not found

michaelrsweet commented 6 months ago

So those values are part of the config.h header, which is generated by the configure script.

It would be useful to see the complete build log - configure output plus the full output from make.

pgnd commented 6 months ago

pebkac. self-inflicted by installing system gs as prereq for {hplip,ghostscript}-printer-app's prereqs.

iiuc, gs, cups, libcusfilters, cups-filters, libppd aren't "libcups3-ified" yet. having system-installs of any of those wreaks some havoc.

that said, this bit does indeed work fine

cd ~
_TOP="/builddir/build/BUILD"
_WI="${_TOP}/work"
_WO="${_TOP}/work.out"

rm -rf   ${_WI}
mkdir -p ${_WI}
cd       ${_WI}

git clone --recurse-submodules https://github.com/OpenPrinting/libcups/
git clone https://github.com/michaelrsweet/pappl

rm -rf   ${_WO}
mkdir -p ${_WO}
cd       ${_WI}

_addl_ld_flags=""
_addl_ld_flags+=" -L${_WO}/lib64"
_addl_ld_flags+=" -L/usr/local/lib64"
_addl_ld_flags+=" -L/usr/lib64"
_addl_ld_flags+=" -lcrypto"
_addl_ld_flags+=" -lssl"

_addl_inc_flags=""
_addl_inc_flags+=" -I."
_addl_inc_flags+=" -I${_WO}/include/libcups3/cups"
_addl_inc_flags+=" -I${_WO}/include/pappl2"
_addl_inc_flags+=" -I${_WO}/include"
_addl_inc_flags+=" -I/usr/local/include"
_addl_inc_flags+=" -I/usr/include"

export CFLAGS="  ${_addl_inc_flags}"
export CXXFLAGS="${_addl_inc_flags}"
export CPPFLAGS="${_addl_inc_flags}"
export LDFLAGS="${_addl_ld_flags}"

export PKG_CONFIG_PATH=".:${_WO}/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig"
export PATH="${_WO}/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"

pushd ./libcups
 ./configure \
  --prefix=${_WO} \
  --libdir=${_WO}/lib64 \
  --with-pkgconfpath=${_WO}/lib64/pkgconfig/
 make --quiet -j$(nproc)
 make --quiet install
popd

pushd ./pappl
./configure \
  --prefix=${_WO} \
  --libdir=${_WO}/lib64 \
  --enable-libpappl2-prefix
make --quiet -j$(nproc)
make --quiet install
popd

tree ${_WO}
    /builddir/build/BUILD/work.out
    ├── bin
    │   ├── ippevepcl -> ipptransform
    │   ├── ippeveprinter
    │   ├── ippeveps -> ipptransform
    │   ├── ippfind
    │   ├── ipptool
    │   ├── ipptransform
    │   └── pappl2-makeresheader
    ├── include
    │   ├── libcups3
    │   │   └── cups
    │   │       ├── array.h
    │   │       ├── base.h
    │   │       ├── cups.h
    │   │       ├── dir.h
    │   │       ├── dnssd.h
    │   │       ├── file.h
    │   │       ├── form.h
    │   │       ├── http.h
    │   │       ├── ipp.h
    │   │       ├── json.h
    │   │       ├── jwt.h
    │   │       ├── language.h
    │   │       ├── ppd.h
    │   │       ├── pwg.h
    │   │       ├── raster.h
    │   │       ├── thread.h
    │   │       └── transcode.h
    │   └── pappl2
    │       └── pappl
    │           ├── base.h
    │           ├── client.h
    │           ├── device.h
    │           ├── job.h
    │           ├── loc.h
    │           ├── log.h
    │           ├── mainloop.h
    │           ├── pappl.h
    │           ├── printer.h
    │           ├── subscription.h
    │           └── system.h
    ├── lib64
    │   ├── libcups3.a
    │   ├── libcups3.so -> libcups3.so.3
    │   ├── libcups3.so.3
    │   ├── libpappl2.a
    │   ├── libpappl2.so -> libpappl2.so.2
    │   ├── libpappl2.so.2
    │   └── pkgconfig
    │       ├── cups3.pc
    │       └── pappl2.pc
    └── share
        ├── doc
        │   ├── libcups3
        │   │   ├── cups.png
        │   │   ├── cups.svg
        │   │   ├── cupspm.epub
        │   │   ├── cupspm.html
        │   │   ├── index.html
        │   │   ├── ippeveprinter.html
        │   │   ├── ippfind.html
        │   │   ├── ipptool.html
        │   │   ├── ipptoolfile.html
        │   │   ├── ipptransform.html
        │   │   ├── libcups.css
        │   │   ├── raster-organization.png
        │   │   ├── raster.png
        │   │   ├── sample-image.png
        │   │   ├── spec-ipp.html
        │   │   └── spec-raster.html
        │   └── pappl2
        │       ├── pappl-512.png
        │       ├── pappl-block.png
        │       └── pappl.html
        ├── libcups3
        │   ├── fonts
        │   │   ├── NotoSansMono-License.txt
        │   │   └── NotoSansMono-Regular.ttf
        │   └── ipptool
        │       ├── cancel-current-job.test
        │       ├── color.jpg
        │       ├── create-job-sheets.test
        │       ├── create-job-timeout.test
        │       ├── create-job.test
        │       ├── create-printer-subscription.test
        │       ├── cups-create-local-printer.test
        │       ├── document-a4.pdf
        │       ├── document-a4.ps
        │       ├── document-letter.pdf
        │       ├── document-letter.ps
        │       ├── fax-job.test
        │       ├── get-completed-jobs.test
        │       ├── get-job-attributes.test
        │       ├── get-job-template-attributes.test
        │       ├── get-jobs.test
        │       ├── get-notifications.test
        │       ├── get-printer-attributes-suite.test
        │       ├── get-printer-attributes.test
        │       ├── get-printers.test
        │       ├── get-subscriptions.test
        │       ├── gray.jpg
        │       ├── identify-printer-display.test
        │       ├── identify-printer.test
        │       ├── ipp-1.1.test
        │       ├── ipp-2.0.test
        │       ├── onepage-a4-300-black-1.pwg
        │       ├── onepage-a4.pdf
        │       ├── onepage-a4.ps
        │       ├── onepage-letter-300-black-1.pwg
        │       ├── onepage-letter.pdf
        │       ├── onepage-letter.ps
        │       ├── print-job-and-wait.test
        │       ├── print-job-deflate.test
        │       ├── print-job-gzip.test
        │       ├── print-job-hold.test
        │       ├── print-job-letter.test
        │       ├── print-job-manual.test
        │       ├── print-job-media-col.test
        │       ├── print-job-media-needed.test
        │       ├── print-job-password.test
        │       ├── print-job-raster.test
        │       ├── print-job.test
        │       ├── print-uri.test
        │       ├── set-attrs-hold.test
        │       ├── testfile.jpg
        │       ├── testfile.pcl
        │       ├── testfile.pdf
        │       ├── testfile.ps
        │       ├── testfile.txt
        │       └── validate-job.test
        └── man
            ├── man1
            │   ├── ippevepcl.1 -> ipptransform.1
            │   ├── ippeveprinter.1
            │   ├── ippeveps.1 -> ipptransform.1
            │   ├── ippfind.1
            │   ├── ipptool.1
            │   ├── ipptransform.1
            │   ├── pappl2-makeresheader.1
            │   └── pappl2.1
            ├── man3
            │   ├── pappl2-client.3
            │   ├── pappl2-device.3
            │   ├── pappl2-job.3
            │   ├── pappl2-log.3
            │   ├── pappl2-mainloop.3
            │   ├── pappl2-printer.3
            │   ├── pappl2-resource.3
            │   └── pappl2-system.3
            └── man5
                └── ipptoolfile.5

    20 directories, 132 files