Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#54412 closed defect (fixed)

nghttp2 @1.23.1 won't build on Snow Leopard, Mac OS X 10.6.8, (cxx_stdlib = libc++) because of "Undefined symbols for architecture x86_64"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version: 2.4.1
Keywords: snowleopard Cc:
Port: nghttp2

Description

libtool: link: /opt/local/bin/clang-mp-3.9 -pipe -Os -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 -o .libs/libevent-client libevent-client.o -pthread  -L/opt/local/lib ../lib/.libs/libnghttp2.dylib ../third-party/.libs/libhttp-parser.a -levent -levent_openssl -lcrypto -lssl -ldl -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
  "_strndup", referenced from:
      _main in libevent-client.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Attachments (4)

main.log (114.5 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
main.log
Portfile-nghttp2.diff (388 bytes) - added by Schamschula (Marius Schamschula) 7 years ago.
patch-examples-libevent-client.c.diff (1.2 KB) - added by Schamschula (Marius Schamschula) 7 years ago.
main.2.log (189.7 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
main.log after the patch

Download all attachments as: .zip

Change History (24)

Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log

comment:1 Changed 7 years ago by Schamschula (Marius Schamschula)

Cc: mps@… removed
Owner: set to Schamschula
Status: newassigned

See: #47507

Last edited 7 years ago by Schamschula (Marius Schamschula) (previous) (diff)

comment:2 in reply to:  1 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Schamschula:

See: https://trac.macports.org/ticket/47507

Isn't

DEBUG: Sourcing PortGroup cxx11 1.0 from /opt/local/var/macports/sources/nue.de.rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/cxx11-1.0.tcl

providing the use of the correct library?

comment:3 Changed 7 years ago by Schamschula (Marius Schamschula)

Peter,

I was a little distracted by the libc++. I looks like this is the same problem earlier seen in gnutls https://trac.macports.org/ticket/51451

I'll look into it later today.

Version 0, edited 7 years ago by Schamschula (Marius Schamschula) (next)

Changed 7 years ago by Schamschula (Marius Schamschula)

Attachment: Portfile-nghttp2.diff added

Changed 7 years ago by Schamschula (Marius Schamschula)

comment:4 Changed 7 years ago by Schamschula (Marius Schamschula)

Please see if the two above patches work for you.

comment:5 Changed 7 years ago by mf2k (Frank Schima)

Guys, please do not use actual links to other Trac tickets. Instead use the WikiFormatting shortcut of the #. So in this case: #47507 and #51451.

comment:6 Changed 7 years ago by mf2k (Frank Schima)

To be clear, this shortcut can only be used in Trac tickets. For git commits, that is the correct way to reference Trac tickets.

comment:7 in reply to:  5 Changed 7 years ago by Schamschula (Marius Schamschula)

Replying to mf2k:

Guys, please do not use actual links to other Trac tickets. Instead use the WikiFormatting shortcut of the #. So in this case: #47507 and #51451.

Frank,

Sorry about that. I've gotten too used to dealing with GitHub links, that muscle memory for trac links failed me...

Last edited 7 years ago by Schamschula (Marius Schamschula) (previous) (diff)

comment:8 in reply to:  4 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Schamschula:

Please see if the two above patches work for you.

The fail:

libevent-client.c:35:39: error: unknown type name 'size_t'
static char * strndup (char const *s, size_t n);
                                      ^
libevent-client.c:36:8: error: unknown type name 'size_t'
static size_t strnlen (const char *string, size_t maxlen);
       ^
libevent-client.c:36:44: error: unknown type name 'size_t'
static size_t strnlen (const char *string, size_t maxlen);
                                           ^
libevent-client.c:38:8: error: unknown type name 'size_t'
static size_t
       ^
libevent-client.c:39:30: error: unknown type name 'size_t'
strnlen (const char *string, size_t maxlen)
                             ^

Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.2.log added

main.log after the patch

comment:9 Changed 7 years ago by Schamschula (Marius Schamschula)

I think, rather than playing a game of whack-a-mole, it might be best to wait for Ken Cunningham's Snow Leopard Fixes to be added to MacPorts.

See: https://github.com/kencu/snowleopardfixes

comment:10 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

With GCC I can use -dD -E to get a pre-processed output of the C source file with some useful definitions of macros and also all C header files included. Does this also work with Clang?

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

Yep, that worked nicely. (snowleopardfixes, I mean).

$ port -v installed nghttp2
The following ports are currently installed:
  nghttp2 @1.23.1_0+python27 (active) platform='darwin 10' archs='x86_64' date='2017-07-03T11:27:54-0700'
Last edited 7 years ago by kencu (Ken) (previous) (diff)

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

If you need this right away Peter, download this Portfile into some folder <https://github.com/kencu/SnowLeopardPorts/blob/master/sysutils/snowleopardfixes/Portfile>, sudo port -v install +universal it, and then stick this in the nghttp2 Portfile somewhere:

if {${os.platform} eq "darwin" && ${os.major} < 11} {
	depends_lib-append          port:snowleopardfixes
	configure.ldflags-append   -lsnowleopardfixes
}

and success will come your way. BTW, you seem to use more ports I've never heard of before than almost anyone else !

Let me know if you have any troubles with it.

comment:13 in reply to:  10 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to ballapete:

With GCC I can use -dD -E to get a pre-processed output of the C source file with some useful definitions of macros and also all C header files included. Does this also work with Clang?

Yes, it can!

comment:14 in reply to:  12 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

If you need this right away []

I followed your recipe in #54410, have libsnowleopardfixes.dylib in /opt/local/lib, have a local tree of Portfiles (and have to remember portindex manually every time I finished) – have now

  nghttp2 @1.24.0_0+python27 (active) platform='darwin 10' archs='x86_64' date='2017-07-03T21:31:56+0200'

installed. Now I am going to close #54410. And maybe #54411 will get fixed too!

comment:15 Changed 7 years ago by Schamschula (Marius Schamschula)

I just committed the snowleopardfixes Portfile: https://github.com/macports/macports-ports/commit/3efea307091e06b1176c8e9c1f771dd1efdea179

I'll see if I can create a PortGroup. Unfortunately, I have no way of testing it, as I don't have a 10.6.8 machine.

Last edited 7 years ago by Schamschula (Marius Schamschula) (previous) (diff)

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

You do have a 10.5 PPC machine - you might try it there, as it should help there too, I hope.

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

I'll delete this comment - for some reason, 1.24.0 is not building for me, but it's something on my end here it seems because Peter just built it I notice.

Last edited 7 years ago by kencu (Ken) (previous) (diff)

comment:18 in reply to:  16 Changed 7 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

You do have a 10.5 PPC machine - you might try it there, as it should help there too, I hope.

I hope that I can start testing on PPC Leopard on Wednesday. Should I install and upgrade Clang 3.7, as documented in LibcxxOnOlderSystems, or should I start with Clang 3.8?

Making Hyper Text Transfer Protocol v. 2 work on PPC Leopard is quite ambitious, I think…

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

clang on 10.5 is a totally different animal, and not quite ready for prime time. The installation and standard library settings are not the same as LibcxxOnOlderSystems at present. I'll get back to you. For now, the cxx11 1.1 portgroup should lead to gcc6 building cxx11 ports, and that works for the most part.

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

Resolution: fixed
Status: assignedclosed

This was fixed by the snowleopard_fixes portgroup

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