Opened 16 months ago

Closed 2 months ago

#67599 closed defect (fixed)

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: khorton (Kevin Horton), dzuolo (Davide Zuolo), ryandesign (Ryan Carsten Schmidt)
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 16 months ago.
main.2.log (1.6 MB) - added by NewBBpy 16 months ago.

Change History (15)

Changed 16 months ago by NewBBpy

Attachment: main.log added

comment:1 Changed 16 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 16 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 16 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 16 months ago by NewBBpy

Attachment: main.2.log added

comment:4 Changed 16 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 16 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 16 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 14 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

comment:8 Changed 2 months ago by dzuolo (Davide Zuolo)

Hi! I am facing the same issue with macOS 14.5. Can someone tell me where I can find the file to change? I can't find them. Thanks a lot, Davide

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

Cc: khorton dzuolo ryandesign added

The files that need to be changed are in the directory identified by the command port work texmaker. But the problem was fixed in texmaker 5.1.4 via this change:

  • texmaker.pro

    old new  
    11481148
    11491149DEFINES += PREFIX=\\\"$${PREFIX}\\\"
    11501150DEFINES +=_FX_CPU_=_FX_X64_
     1151DEFINES += HAVE_UNISTD_H
    11511152
    11521153
    11531154INCLUDEPATH +=$${QTDIR}/include/

I'll add a patch to fix that shortly and then submit a PR to update to 5.1.4, so if you wait an hour and then sudo port selfupdate, you should be able to install the port without needing to patch anything manually.

I could find no option to have texmaker use MacPorts copies of zlib and the many other libraries texmaker bundles. I'll submit that suggestion to the developer.

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

Resolution: fixed
Status: assignedclosed

In 448a3c6a20e5d3163399155d3e9bc736552ad841/macports-ports (master):

texmaker: Fix implicit declaration of functions

Closes: #67599

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

Resolution: fixed
Status: closedreopened

My testing was wrong. That patch, and the 5.1.4 release, do not fix the problem.

The problem occurs for me on macOS 12 when using MacPorts clang-18 but not when using Xcode clang. I used MacPorts clang-18 on the original test and then forgot to specify that compiler again when retesting with the patch.

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

The patch adds HAVE_UNISTD_H to DEFINES within a unix:!macx { } block, so it only takes effect for Unix systems that are not macOS.

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

Resolution: fixed
Status: reopenedclosed

In 9e90f639e91d73c158085ce93f2e1f82a5cbceff/macports-ports (master):

texmaker: Fix more build errors with newer compilers

Closes: #67599

Note: See TracTickets for help on using tickets.