~geyaeb/haskell-pdftotext

4 2

how to install pdftotext on osx with stack

Details
Message ID
<CAHJ505HGuNmGvSu5S95ZdeGkK-+kwK9MabGSEwMXict9FNznXg@mail.gmail.com>
DKIM signature
pass
Download raw message
hi -
i'm trying to install pdftotext on osx 10.15.7.
stack 2.3.3, lts-16.13 (ghc 8.8.4)

i used macports 2.6.4 to install the latest poppler:
$ port list poppler
poppler                        @20.11.0        graphics/poppler
and the command line pdftotext that comes with poppler works.

in `stack.yaml` i have:
extra-deps:
- pdftotext-0.1.0.0@sha256:8b7be411e7d4593421d4b27c8cc7665d380398e30a93d88b6ebb0d5b9cc51834,2706

(that's what stack suggested when plain `pdftotext` didn't work)

and in `package.yaml` i have:
dependencies:
- pdftotext

when i try to build, it fails with:

$ stack build

pdftotext> configure

pdftotext> Configuring pdftotext-0.1.0.0...

pdftotext> build

pdftotext> Preprocessing library for pdftotext-0.1.0.0..

pdftotext> Building library for pdftotext-0.1.0.0..

pdftotext> [1 of 3] Compiling Pdftotext.Foreign

pdftotext> [2 of 3] Compiling Pdftotext.Internal

pdftotext> [3 of 3] Compiling Pdftotext

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/In
file included from cbits/poppler.cc:1:0: error:

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/In
file included from
/opt/local/include/poppler/cpp/poppler-document.h:25:0: error:

pdftotext>

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-global.h:51:40:
error:

pdftotext>      warning: deleted function definitions are a C++11
extension [-Wc++11-extensions]

pdftotext>         noncopyable(const noncopyable &) = delete;

pdftotext>                                            ^

pdftotext>    |

pdftotext> 51 |     noncopyable(const noncopyable &) = delete;

pdftotext>    |                                        ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-global.h:52:57:
error:

pdftotext>      warning: deleted function definitions are a C++11
extension [-Wc++11-extensions]

pdftotext>         const noncopyable &operator=(const noncopyable &) = delete;

pdftotext>                                                             ^

pdftotext>    |

pdftotext> 52 |     const noncopyable &operator=(const noncopyable &) = delete;

pdftotext>    |                                                         ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/In
file included from cbits/poppler.cc:2:0: error:

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-page.h:41:23:
error:

pdftotext>      warning: rvalue references are a C++11 extension
[-Wc++11-extensions]

pdftotext>         text_box(text_box &&) noexcept;

pdftotext>                           ^

pdftotext>    |

pdftotext> 41 |     text_box(text_box &&) noexcept;

pdftotext>    |                       ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-page.h:41:26:
error:

pdftotext>      error: expected ';' at end of declaration list

pdftotext>         text_box(text_box &&) noexcept;

pdftotext>                              ^

pdftotext>                              ;

pdftotext>    |

pdftotext> 41 |     text_box(text_box &&) noexcept;

pdftotext>    |                          ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-page.h:42:34:
error:

pdftotext>      warning: rvalue references are a C++11 extension
[-Wc++11-extensions]

pdftotext>         text_box &operator=(text_box &&) noexcept;

pdftotext>                                      ^

pdftotext>    |

pdftotext> 42 |     text_box &operator=(text_box &&) noexcept;

pdftotext>    |                                  ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0//opt/local/include/poppler/cpp/poppler-page.h:42:37:
error:

pdftotext>      error: expected ';' at end of declaration list

pdftotext>         text_box &operator=(text_box &&) noexcept;

pdftotext>                                         ^

pdftotext>                                         ;

pdftotext>    |

pdftotext> 42 |     text_box &operator=(text_box &&) noexcept;

pdftotext>    |                                     ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/cbits/poppler.cc:98:71:
error:

pdftotext>      warning: use of enumeration in a nested name specifier
is a C++11 extension [-Wc++11-extensions]

pdftotext>           return to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::raw_order_layout));

pdftotext>
              ^

pdftotext>    |

pdftotext> 98 |       return to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::raw_order_layout));

pdftotext>    |
               ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/cbits/poppler.cc:101:71:
error:

pdftotext>      warning: use of enumeration in a nested name specifier
is a C++11 extension [-Wc++11-extensions]

pdftotext>           return to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::physical_layout));

pdftotext>
              ^

pdftotext>     |

pdftotext> 101 |       return
to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::physical_layout));

pdftotext>     |
                ^

pdftotext>

pdftotext> /private/var/folders/dm/2pwnn90n6zb_sls6g88qg9q00000gn/T/stack-385e5fd38ee263c8/pdftotext-0.1.0.0/cbits/poppler.cc:104:71:
error:

pdftotext>      warning: use of enumeration in a nested name specifier
is a C++11 extension [-Wc++11-extensions]

pdftotext>           return to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::non_raw_non_physical_layout));

pdftotext>
              ^

pdftotext>     |

pdftotext> 104 |       return
to_stdstring(page->text(poppler::rectf(),
poppler::page::text_layout_enum::non_raw_non_physical_layout));

pdftotext>     |
                ^

pdftotext> 7 warnings and 2 errors generated.

pdftotext> `gcc' failed in phase `C Compiler'. (Exit code: 1)



--  While building package pdftotext-0.1.0.0 using:

      /Users/eflister/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4
--builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build
--ghc-options " -fdiagnostics-color=always"

    Process exited with code: ExitFailure 1

Progress 1/2

thanks for your help!
-erik
Details
Message ID
<TKmnB0lEezrjeTMKwRu7O5gfFVeBie6VuKbU6sq7e_SxpAj40cszZ-pkYHkCfzBSqbdUqEM6LSDXwO_w_wKUTpcwdPMae4jQZ9eA3rfsDo0=@protonmail.com>
In-Reply-To
<CAHJ505HGuNmGvSu5S95ZdeGkK-+kwK9MabGSEwMXict9FNznXg@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Hello, Erik.

Unfortunately I cannot try on MacOS but after some searching and
testing, it seems that poppler requires to be compiled with standard
C++11 while your compiler does not use it by default.

Could you try to clone the project, modify .cabal and then point stack
dependency to the local version?

> hg clone https://hg.sr.ht/~geyaeb/haskell-pdftotext
> cd haskell-pdftotext

Edit pdftotext.cabal by adding "-std=c++11" to "cc-options".
The line now looks like:

cc-options: -Wall -fPIC -std=c++11

Then you can point to this cloned directory inside your project's
stack.yaml's extra-deps as dependency to pdftotext.

extra-deps:
  - ../haskell-pdftotext
  - …

If it works, I will add this change directly to the package.

Thanks!

G. Eyaeb
Details
Message ID
<CAHJ505HyaFjhHnpLJVnXqYfJc0qFjDcmvq0bYsUjyDodfokL8Q@mail.gmail.com>
In-Reply-To
<TKmnB0lEezrjeTMKwRu7O5gfFVeBie6VuKbU6sq7e_SxpAj40cszZ-pkYHkCfzBSqbdUqEM6LSDXwO_w_wKUTpcwdPMae4jQZ9eA3rfsDo0=@protonmail.com> (view parent)
DKIM signature
pass
Download raw message
ok, it got farther, but then linker couldn't find _iconv:

$ stack build

covid-0.1.0.0: unregistering (missing dependencies: pdftotext)

free     > using precompiled package

range    > using precompiled package

pdftotext> configure (lib + exe)

pdftotext> Configuring pdftotext-0.1.0.0...

pdftotext> build (lib + exe)

pdftotext> Preprocessing library for pdftotext-0.1.0.0..

pdftotext> Building library for pdftotext-0.1.0.0..

pdftotext> [1 of 3] Compiling Pdftotext.Foreign

pdftotext> [2 of 3] Compiling Pdftotext.Internal

pdftotext> [3 of 3] Compiling Pdftotext

pdftotext> Preprocessing executable 'pdftotext.hs' for pdftotext-0.1.0.0..

pdftotext> Building executable 'pdftotext.hs' for pdftotext-0.1.0.0..

pdftotext> [1 of 1] Compiling Main

pdftotext> Linking
.stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/pdftotext.hs/pdftotext.hs
...

pdftotext> Undefined symbols for architecture x86_64:

pdftotext>   "_iconv", referenced from:

pdftotext>       _hs_iconv in libHSbase-4.13.0.0.a(iconv.o)

pdftotext>      (maybe you meant:
_base_GHCziIOziEncodingziIconv_iconvEncoding12_info,
_base_GHCziIOziEncodingziIconv_iconvEncoding1_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding15_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding7_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding6_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding6_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding5_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _hs_iconv_open ,
_base_GHCziIOziEncodingziIconv_iconvEncoding12_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding9_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding9_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding13_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding11_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding11_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding8_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding10_bytes ,
_base_GHCziIOziEncodingziIconv_iconvEncoding2_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding7_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding1_closure ,
_hs_iconv_close , _hs_iconv ,
_base_GHCziIOziEncodingziIconv_iconvEncoding15_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding3_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding4_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding2_info ,
_base_GHCziIOziEncodingziIconv_iconvEncoding13_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding_closure ,
_base_GHCziIOziEncodingziIconv_iconvEncoding14_bytes ,
_base_GHCziIOziEncodingziIconv_iconvEncoding4_info )

pdftotext>   "_iconv_open", referenced from:

pdftotext>       _hs_iconv_open in libHSbase-4.13.0.0.a(iconv.o)

pdftotext>      (maybe you meant: _hs_iconv_open)

pdftotext>   "_iconv_close", referenced from:

pdftotext>       _hs_iconv_close in libHSbase-4.13.0.0.a(iconv.o)

pdftotext>      (maybe you meant: _hs_iconv_close)

pdftotext>   "_locale_charset", referenced from:

pdftotext>       _localeEncoding in libHSbase-4.13.0.0.a(PrelIOUtils.o)

pdftotext> ld: symbol(s) not found for architecture x86_64

pdftotext> clang: error: linker command failed with exit code 1 (use
-v to see invocation)

pdftotext> `gcc' failed in phase `Linker'. (Exit code: 1)



--  While building package pdftotext-0.1.0.0 using:

      /Users/eflister/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4
--builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build
lib:pdftotext exe:pdftotext.hs --ghc-options "
-fdiagnostics-color=always"

    Process exited with code: ExitFailure 1

Progress 3/4
Details
Message ID
<CAHJ505EsFaoqHpXRchJQF0R7RN7_qMNRByMRC9BSo5=zkAtfvQ@mail.gmail.com>
In-Reply-To
<CAHJ505HyaFjhHnpLJVnXqYfJc0qFjDcmvq0bYsUjyDodfokL8Q@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
according to https://stackoverflow.com/questions/32584505/hmatrix-breaks-in-a-file-what-could-be-the-cause
i added `extra-lib-dirs: /usr/lib` to the `library` section of the
`cabal`, and that worked.
but see warning at https://stackoverflow.com/a/64278835/1441998

also discussed in these spots:
http://blog.omega-prime.co.uk/2011/01/28/solving-ghc-iconv-problems-on-os-x-10-6/
https://gitlab.haskell.org/ghc/ghc/-/issues/18743
Details
Message ID
<CGx5ljRZlwDCspGyQXOIqPWHzG1zRwSbOyPrb1AxAb7eis_mhE8NpMXNhq6Xj05U__ckY-Lrs7BZ78KkeSd-Cc4dBc41EYrOXI6WK6m-4o4=@protonmail.com>
In-Reply-To
<CAHJ505EsFaoqHpXRchJQF0R7RN7_qMNRByMRC9BSo5=zkAtfvQ@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Thanks a lot for the links.

Well, it seems that it is somewhere deep inside GHC. I am afraid
there is not much I can do besides adding some note into README.
So that's what I will do.

Thanks again and please let me know if there is something I could
improve in the library.

G.
Reply to thread Export thread (mbox)