Opened 6 months ago
Closed 7 weeks ago
#72436 closed defect (fixed)
nodejs20: error: expected identifier or '('
| Reported by: | cgilles (HumanDynamo) | Owned by: | ci42 |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | ||
| Port: | nodejs20 |
Description (last modified by cgilles (HumanDynamo))
Macbook pro M1 MacOS Sequoia 15.4.1 XCode 16.3
Note: for backward compatibility, MacOS SDK version 11.3 is installed and used to compile all Macports packages. From my /opt/digikam.org.arm64/etc/macports/macports.conf:
... macosx_deployment_target 11.3 build_arch arm64 ...
---> Computing dependencies for qt6-sqlite-plugin ---> Cleaning qt6-sqlite-plugin ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found. ---> Computing dependencies for qt6-mysql-plugin ---> Cleaning qt6-mysql-plugin ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found. ---> Computing dependencies for qt6-qtwebengine ---> Dependencies to be installed: nodejs20 py313-html5lib py313-ply qt6-qtwebchannel qt6-qtpositioning py313-six py313-webencodings qt6-qtwebsockets gconf qt6-qtserialport policykit orbit2 duktape libidl ---> Fetching distfiles for nodejs20 ---> Verifying checksums for nodejs20 ---> Extracting nodejs20 ---> Applying patches to nodejs20 ---> Configuring nodejs20 ---> Building nodejs20 Error: Failed to build nodejs20: command execution failed Error: See /opt/digikam.org.arm64/var/macports/logs/_opt_digikam.org.arm64_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_nodejs20/nodejs20/main.log for details. Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug. Error: Processing of port qt6-qtwebengine failed FAILED COMMAND: port install qt$DK_QTVERSION$MP_QTSUBVERSION-qtwebengine -examples -tests
Attachments (1)
Change History (12)
Changed 6 months ago by cgilles (HumanDynamo)
| Attachment: | main.log.gz added |
|---|
comment:1 Changed 6 months ago by cgilles (HumanDynamo)
| Description: | modified (diff) |
|---|
comment:2 Changed 6 months ago by cgilles (HumanDynamo)
| Description: | modified (diff) |
|---|
comment:3 Changed 6 months ago by jmroot (Joshua Root)
| Owner: | set to ci42 |
|---|---|
| Status: | new → assigned |
comment:4 Changed 6 months ago by cgilles (HumanDynamo)
comment:5 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
| Summary: | nodejs20 build fail while installing Qt6-WebEngine → nodejs20: error: expected identifier or '(' |
|---|
The log says:
In file included from ../deps/v8/third_party/zlib/zutil.c:10:
In file included from ../deps/v8/third_party/zlib/gzguts.h:21:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdio.h:61:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
318 | FILE *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
| ^
../deps/v8/third_party/zlib/zutil.h:162:33: note: expanded from macro 'fdopen'
162 | # define fdopen(fd,mode) NULL /* No fdopen() */
| ^
/Library/Developer/CommandLineTools/usr/lib/clang/17/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
26 | #define NULL ((void*)0)
| ^
The nodejs20 port declares a dependency on the zlib port, yet this error seems to be coming from a bundled copy of zlib. nodejs20 should be using MacPorts zlib, not a bundled copy, if possible, which will probably avoid this problem since whatever the problem is is probably already fixed in or not a problem for the MacPorts zlib port. (There have been problems before with projects that bundle zlib incorrectly.)
comment:6 Changed 6 months ago by cgilles (HumanDynamo)
yes, nodejs has 3 options to use an external zlib :
https://github.com/nodejs/node/blob/main/configure.py
...line 420...
comment:7 follow-up: 9 Changed 6 months ago by cgilles (HumanDynamo)
Problem : the nodejs Portfile already use the external zlib :
https://github.com/macports/macports-ports/blob/master/devel/nodejs20/Portfile#L120
comment:8 Changed 6 months ago by cgilles (HumanDynamo)
Note: nodejs22 compile fine under Sequoia...
comment:9 Changed 6 months ago by reneeotten (Renee Otten)
Replying to cgilles:
Problem : the nodejs Portfile already use the external zlib :
https://github.com/macports/macports-ports/blob/master/devel/nodejs20/Portfile#L120
Possibly this line is the issue:
configure.args-append --shared-zlib-includes=${workpath}/zlib-inc
why is that not pointing to the usual ${prefix}/include?
[edit: okay, I didn't read carefully enough... the reasoning is explained in the Portfile. Well, then I don't know either ;) ]
comment:10 Changed 8 weeks ago by ryandesign (Ryan Carsten Schmidt)
FYI that line is now https://github.com/macports/macports-ports/blob/master/lang/nodejs20/Portfile#L123
Yes, the --shared-zlib* flags tell nodejs to use MacPorts zlib. But it is also still building its bundled zlib, even though it is not being used for anything. And the bundled zlib is old and has a bug so it cannot build on new systems.
A fix went into nodejs 24.0.0 which, if I understand correctly, would allow us to delete the bundled zlib source code (e.g. in a post-extract block) and it will still build ok since we are using shared zlib.
The fix was backported to nodejs 22.13.0 so we could do the same there.
nodejs24 and nodejs22 ports do not have this build failure presumably because they use a newer bundled zlib, however it is still a waste of time to build the bundled zlib there.
The fix was backported to nodejs 20.19.3. We would need to update the nodejs20 port to at least this version before we could then do the same fix here.
nodejs 18.20.7 also received the fix. We would need to update the nodejs18 port first.
nodejs16 and presumably earlier did not receive an official fix but it's a simple patch that we could probably backport.
comment:11 Changed 7 weeks ago by jmroot (Joshua Root)
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

it's the similar compilation problem in this report: https://github.com/pocoproject/poco/issues/4586
Sounds like ann issue with zlib