Opened 11 months ago

Last modified 10 months ago

#67599 assigned defect

texmaker @5.1.2_1 build failure: call to undeclared function 'lseek'

Reported by: NewBBpy Owned by: harens (Haren S)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: texmaker

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hello,

The port texmaker failed to build on my MacOs Ventura 13.3.1 (22E261) even after cleaning and computer restart.

--->  Building texmaker
Error: Failed to build texmaker: command execution failed

I don't know what is the problem.
Many Thanks for your help.
NewBBpy

Attachments (2)

main.log (977.5 KB) - added by NewBBpy 11 months ago.
main.2.log (1.6 MB) - added by NewBBpy 11 months ago.

Change History (9)

Changed 11 months ago by NewBBpy

Attachment: main.log added

comment:1 Changed 11 months ago by jmroot (Joshua Root)

Keywords: Failed to build texmaker removed
Owner: set to harens
Port: @5.1.2_1 (tex editors) removed
Status: newassigned
Summary: Failed to build texmaker: command execution failedtexmaker @5.1.2_1 build failure: call to undeclared function 'lseek'

comment:2 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

Well lseek is defined in unistd.h so the simplest solution would be to add #include <unistd.h> in pdfium/third_party/zlib_v128/gzlib.c or the gzguts.h header it includes however the developer of zlib states that's not the correct fix; see rejected pull requests https://github.com/madler/zlib/pull/509 and https://github.com/madler/zlib/pull/560.

We have dealt with the same problem in other ports that bundle zlib, like freeimage in #61790.

If there is any option for texmaker to use MacPorts zlib instead of its bundled copy, one would think that would solve this problem, and also confer all of the usual benefits of depending on other MacPorts ports (e.g. getting an up-to-date version: MacPorts has zlib 1.2.13 vs 1.2.8 bundled in texmaker).

comment:3 Changed 11 months ago by NewBBpy

I have added #include <unistd.h> in pdfium/third_party/zlib_v128/gzlib.c (after cleaning) and try again but it still failed to build.

sudo port install texmaker
--->  Computing dependencies for texmaker
--->  Fetching archive for texmaker
--->  Attempting to fetch texmaker-5.1.2_1.darwin_22.arm64.tbz2 from https://packages.macports.org/texmaker
--->  Attempting to fetch texmaker-5.1.2_1.darwin_22.arm64.tbz2 from https://fra.de.packages.macports.org/texmaker
--->  Attempting to fetch texmaker-5.1.2_1.darwin_22.arm64.tbz2 from https://ema.uk.packages.macports.org/texmaker
--->  Building texmaker
Error: Failed to build texmaker: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_tex_texmaker/texmaker/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port texmaker failed

Changed 11 months ago by NewBBpy

Attachment: main.2.log added

comment:4 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)

The errors in your new log are:

pdfium/third_party/zlib_v128/gzread.c:30:15: error: call to undeclared function 'read'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        ret = read(state->fd, buf + *have, len - *have);
              ^
pdfium/third_party/zlib_v128/gzread.c:590:11: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    ret = close(state->fd);
          ^
pdfium/third_party/zlib_v128/gzwrite.c:84:15: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        got = write(state->fd, strm->next_in, strm->avail_in);
              ^

According to man 2 read, man 2 close, and man 2 write, <unistd.h> is also where those are declared, so that include would need to be added to those files as well, or, as in the fix for the other port, that might happen automatically if -DHAVE_UNISTD_H were set. My advice to have texmaker switch to using MacPorts zlib instead stands.

comment:5 Changed 11 months ago by NewBBpy

Thank you for your comment, zlib is indeed installed but I have no clue how to make texmaker switch to Macports zlib ? Is there an easy way ?

...% port installed zlib
The following ports are currently installed:
  zlib @1.2.13_0 (active)

comment:6 Changed 11 months ago by NewBBpy

As Ryan suggested manually adding #include <unistd.h> in the 3 files pdfium/third_party/zlib_v128/gzlib.c, gwrite.c and gread.c does allow texmaker to build. It works for me, even if it's not the best fix. Many thanks.

comment:7 Changed 10 months ago by khorton (Kevin Horton)

The build errors are still present with texmaker 5.1.2_2 on macOS 13.4.1 (c) (22F770820d) using Xcode 14.3.1.

:info:build pdfium/third_party/zlib_v128/gzlib.c:256:24: error: call to undeclared function 'lseek'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

:info:build pdfium/third_party/zlib_v128/gzread.c:30:15: error: call to undeclared function 'read'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build pdfium/third_party/zlib_v128/gzread.c:590:11: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

:info:build pdfium/third_party/zlib_v128/gzwrite.c:84:15: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

:error:build Failed to build texmaker: command execution failed

Note: See TracTickets for help on using tickets.