freebsd / portmaster

FreeBSD port management script without external databases or languages
77 stars 40 forks source link

Wrong linker (base) is being used when using Clang from ports #48

Closed oparoz closed 8 years ago

oparoz commented 8 years ago

Env

FreeBSD 10.2, amd64 Toolchain from ports: llvm37, clang37, binutils

Problem

When using portmaster to install ports (some of which were first installed as packages), the wrong linker is being used.

configure:3960: clang37 -O2 -pipe -D_FORTIFY_SOURCE=2 -flto -march=native  -fstack-protector-strong --param ssp-buffer-size=4 -fno-strict-aliasing   -Wl,-z,relro,-z,now -Wl,-rpath=/usr/local/lib -fstack-protector conftest.c -lpthread >&5
/usr/bin/ld: unrecognized option '-plugin'

If I don't use portmaster and do a make reinstall, then the correct linker is being used. I can't find a portmaster variable which could fix the problem.

Conf

MAKE_SHELL?=sh
OPTIONS_SET= INET6 IPV6 THREADS OPTIMIZED_CFLAGS ICONV_PORT
OPTIONS_UNSET= X11 NLS DOCS DEBUG EXAMPLES
WITH_UTF8=YES
WITH_CCACHE_BUILD=yes
OPTIMIZED_CFLAGS=YES
CPUTYPE?=native
CCVER=clang37
CC=clang37
CXX=clang++37
CPP=clang-cpp37
oparoz commented 8 years ago

Ah, I just found out that make reinstall works from bash and there the path is different, /usr/local comes first. I don't think it's a proper solution though. Am I wrong?

bapt commented 8 years ago

I do not think this is a portmaster issue, but a ports issue, I have faced the same issue (well it was highlighted by) when updating binutils to 2.26

oparoz commented 8 years ago

It's true that I don't have the issue on 9.x, using gcc from ports.

oparoz commented 8 years ago

OK, so the workaround seems to be to add LDFLAGS+=-B${LOCALBASE}/bin to make.conf