Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#60184 closed defect (fixed)

libuv @1.35.0+universal: Undefined symbols for architecture i386: "_close$NOCANCEL"

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: libuv

Description

I cannot upgrade libuv @1.34.2_0+universal to 1.35.0_0 on High Sierra:

:info:build Undefined symbols for architecture i386:
:info:build   "_close$NOCANCEL", referenced from:
:info:build       _uv__close_nocancel in libuv_la-core.o
:info:build       _uv__close_nocheckstdio in libuv_la-core.o
:info:build ld: symbol(s) not found for architecture i386
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

Attachments (1)

main.log (128.7 KB) - added by ryandesign (Ryan Carsten Schmidt) 5 years ago.

Download all attachments as: .zip

Change History (11)

Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log added

comment:1 Changed 5 years ago by kencu (Ken)

this likely relates to the previously-working i386 fixes I did for libuv. Something must have changed there. Will check.

I guess I should switch some systems to libuv-devel...

comment:2 Changed 5 years ago by kencu (Ken)

Looks like I have some work to do:

$ sudo port -v destroot libuv +universal
Password:
--->  Computing dependencies for libuv.
--->  Fetching distfiles for libuv
--->  Verifying checksums for libuv
--->  Checksumming libuv-1.30.0.tar.gz
--->  Extracting libuv
--->  Extracting libuv-1.30.0.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libuv/libuv/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/libuv/libuv-1.30.0.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
--->  Applying patches to libuv
--->  Applying patch-libuv-unix-core-close-nocancel.diff
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libuv/libuv/work/libuv-1.30.0" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libuv/files/patch-libuv-unix-core-close-nocancel.diff'
patching file src/unix/core.c
Hunk #1 FAILED at 514.
1 out of 1 hunk FAILED -- saving rejects to file src/unix/core.c.rej
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libuv/libuv/work/libuv-1.30.0" && /usr/bin/patch -p0 < '/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/libuv/files/patch-libuv-unix-core-close-nocancel.diff'
Exit code: 1
Error: Failed to patch libuv: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libuv/libuv/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port libuv failed
Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:3 Changed 5 years ago by kencu (Ken)

looks like libuv added another define to the test, but didn't consider that it might be defined to 0, so it is not doing what they think it is doing. I'll set up a local fix, and then we can fix it upstream at some point.

comment:4 Changed 5 years ago by kencu (Ken)

this is the new line in the patch that is needed to replace the old one:

+# if defined(__LP64__) || __LP64__ || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE > 0))

comment:5 Changed 5 years ago by ken-cunningham-webuse

Resolution: fixed
Status: assignedclosed

In b3cfd196975b2a27f25b78b5139743c2db0835cd/macports-ports (master):

libuv: fix universal build

closes: #60184

comment:6 Changed 5 years ago by michaelld (Michael Dickens)

Nice catch! Good plan on taking it upstream.

comment:7 Changed 5 years ago by kencu (Ken)

I have to check -- does this work?:

#if __LP64__ || TARGET_OS_IPHONE

Otherwise we need:

if (defined(__LP64__) && __LP64__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)

And BTW what works on clang does not necessarily work on gcc-4.2, blah, blah, blah.

There should be some easier, clearer, less gobblygook method of doing this... you want to know if it's both defined, and defined to be not 0, ideally in one test...

comment:8 in reply to:  7 ; Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to kencu:

I have to check -- does this work?:

#if __LP64__ || TARGET_OS_IPHONE

Otherwise we need:

if (defined(__LP64__) && __LP64__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)

As far as I can tell, in the other places where we use __LP64__ in MacPorts, such as various port patchfiles, we only check if __LP64__ is defined. We do not check its value. It is only defined when in 64-bit mode, so its value is irrelevant. Checking on my system, its value is 1; if that is consistent, then it does not matter whether you check its value or whether it's defined, since undefined symbols evaluate to 0.

As for TARGET_OS_IPHONE, if you are on an Apple OS and have included TargetConditionals.h, then TARGET_OS_IPHONE (and the other related defines) will be defined to either 0 or 1 depending on your OS. If you are not on an Apple OS or have not included TargetConditionals.h then they will not be defined. So checking whether it is defined is not enough; you definitely need to check its value. Whether or not you check whether it is defined first is, as above, a matter of style, since undefined defines evaluate to 0.

And BTW what works on clang does not necessarily work on gcc-4.2, blah, blah, blah.

Why would you say that? __LP64__ should be supported in any 64-bit-capable compiler. TARGET_OS_IPHONE is from the OS headers and does not depend on a specific compiler.

comment:9 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Earlier in the file they have this line:

#if defined(__APPLE__) && !TARGET_OS_IPHONE

To match that style (i.e. not checking whether TARGET_OS_IPHONE is defined before using it) I would recommend using:

#if defined(__LP64__) || TARGET_OS_IPHONE

comment:10 in reply to:  8 Changed 5 years ago by kencu (Ken)

I shall endeavour to make sure the test is as robust as possible upstream. Thanks!

Last edited 5 years ago by kencu (Ken) (previous) (diff)
Note: See TracTickets for help on using tickets.