Opened 7 years ago

Closed 7 years ago

#54410 closed defect (fixed)

util-linux @2.29.2 fails to 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: kurthindenburg (Kurt Hindenburg)
Priority: Normal Milestone:
Component: ports Version: 2.4.1
Keywords: snowleopard Cc:
Port: util-linux

Description

libtool: link: ranlib .libs/libcommon.a
libtool: link: ( cd ".libs" && rm -f "libcommon.la" && ln -s "../libcommon.la" "libcommon.la" )
/bin/sh ./libtool  --tag=CC   --mode=link /opt/local/bin/clang-mp-3.9 -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wextra-semi -Wembedded-directive -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wimplicit-function-declaration -pipe -Os -arch x86_64  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o column text-utils/column.o -L/opt/local/lib -lintl -R/opt/local/lib -Wl,-framework -Wl,CoreFoundation libcommon.la 
/bin/sh ./libtool  --tag=CC   --mode=link /opt/local/bin/clang-mp-3.9 -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wextra-semi -Wembedded-directive -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wimplicit-function-declaration -pipe -Os -arch x86_64  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -o scriptreplay term-utils/scriptreplay.o -L/opt/local/lib -lintl -R/opt/local/lib -Wl,-framework -Wl,CoreFoundation libcommon.la 
libtool: link: /opt/local/bin/clang-mp-3.9 -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wextra-semi -Wembedded-directive -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wimplicit-function-declaration -pipe -Os -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 -o column text-utils/column.o -Wl,-framework -Wl,CoreFoundation  -L/opt/local/lib -lintl ./.libs/libcommon.a
libtool: link: /opt/local/bin/clang-mp-3.9 -fsigned-char -fno-common -Wall -Werror=sequence-point -Wextra -Wextra-semi -Wembedded-directive -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wredundant-decls -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-parameter -Wunused-result -Wunused-variable -Wnested-externs -Wpointer-arith -Wstrict-prototypes -Wformat-security -Wimplicit-function-declaration -pipe -Os -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 -o scriptreplay term-utils/scriptreplay.o -Wl,-framework -Wl,CoreFoundation  -L/opt/local/lib -lintl ./.libs/libcommon.a
Undefined symbols for architecture x86_64:
  "_wcsdup", referenced from:
      _input in column.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 (1)

main.log (171.1 KB) - added by ballapete (Peter "Pete" Dyballa) 7 years ago.
main.log

Download all attachments as: .zip

Change History (6)

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

Attachment: main.log added

main.log

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

Hmm. oops. Looks like that is one of SnowLeopard's missing glibc function that I haven't taken care of yet in my <https://github.com/kencu/snowleopardfixes> library.

It's a pretty easy one though <https://opensource.apple.com/source/Libc/Libc-825.26/string/FreeBSD/wcsdup.c.auto.html>

Maybe try sticking this into a file that is likely named column.c and see if that works. If it does, please make a patch and help us all out! In the meantime, I'll add it to the remaining list I need to add.

wchar_t *
wcsdup(const wchar_t *s)
{
	wchar_t *copy;
	size_t len;

	len = wcslen(s) + 1;
	if ((copy = malloc(len * sizeof(wchar_t))) == NULL)
		return (NULL);
	return (wmemcpy(copy, s, len));
}
Last edited 7 years ago by kencu (Ken) (previous) (diff)

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

I added it to the snowleopardfixes library, and then adding this bit to the portfile:

platform darwin 10 {
	depends_lib-append          port:snowleopardfixes
	configure.ldflags-append   -lsnowleopardfixes
}

and the port built:

$ sudo port -v installed util-linux
The following ports are currently installed:
  util-linux @2.29.2_0 (active) platform='darwin 10' archs='x86_64' date='2017-07-02T11:53:21-0700'

IF you decide to use the library, a Portfile to install it is here: <https://github.com/kencu/SnowLeopardPorts/tree/master/sysutils/snowleopardfixes>

So - this is a workaround - pretty easy to use - but the proper fix would be to report this to the devs so they can add a check for it in autotools. sometimes they do. Very often they do not (actually I have never seen them do it once, come to think of it). The next option is to do it with a patch.

I like the library because it works so easily. It may not turn out to be 100% perfect in every situation, though. I need to figure out a better way to use the header more selectively. You don't always need the header (as in this port, which didn't like it), but I'd be happier if I could figure out a way to include the function definitions only when needed.

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

Replying to kencu:

Wouldn't be easier to remove column from the list of utilities? Snow Leopard has a column command. This is better than having a command of the same name that does nothing.

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

Cc: khindenburg@… removed
Owner: set to kurthindenburg
Status: newassigned

comment:5 Changed 7 years ago by kurthindenburg (Kurt Hindenburg)

Resolution: fixed
Status: assignedclosed

In 7e06fb25e9464ce95d9474b0095c21069bd6d07f/macports-ports:

util-linux: add snowleopardfixes

closes #54410

Note: See TracTickets for help on using tickets.