Re: .configure && make fails to find ld [dlopen]

2017-07-05 Thread blubee blubeeme
Thanks for the reply, I haven't set any -static in my env variables or
anything like that. Here's a brief output of my env


   1. OSTYPE=FreeBSD
   2. MACHTYPE=x86_64
   3. CC=clang
   4. PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
   5. EDITOR=vi
   6. LDFLAGS=-L/usr/local/lib
   7. LD_LIBRARY_PATH=/usr/local/llvm38/lib
   8. CPPFLAGS=-I/usr/local/include
   9. CXX=clang++
   10. SHELL=/bin/tcsh
   11. HOSTTYPE=FreeBSD
   12. CFLAGS=-I/usr/local/include


the linking to ldl is being done automatically since I call autoreconf -fi
and that sets up an m4 directory. grep -rn "\-ldl" in the root of the
source folder shows that the built in configure script and the scripts in
the m4 directory sets up those dlopen link example

# if libdl is installed we need to link against it
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl"
>&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

those are sprinkled all over the place, how do I avoid that and use libc
instead?

Best,
Owen

On Thu, Jul 6, 2017 at 8:14 AM, Simon J. Gerraty  wrote:

> blubee blubeeme  wrote:
> > I run autoreconf -fi and it asks me to add AC_CONFIG_MACRO_DIRS([m4]) to
> my
> > configure.ac file, which I do. It creates a ./m4 directory and proceeds.
> >
> > After running .configure --prefix=/tmp [for testing] that' also goes
> fine,
> > except .configure cannot find dlopen
> > checking for dlopen in -ldl... no
>
> dlopen is actually implemeted in the rtld - so you need to link at least
> one shared lib (usually libc) to get it.
>
> > make also fails when it comes time to link because of the dlopen although
> > it's a part of FreeBSD libc
>
> Check that you don't have -static or equivalent in CFLAGS/LDFLAGS.
>
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: .configure && make fails to find ld [dlopen]

2017-07-05 Thread Simon J. Gerraty
blubee blubeeme  wrote:
> I run autoreconf -fi and it asks me to add AC_CONFIG_MACRO_DIRS([m4]) to my
> configure.ac file, which I do. It creates a ./m4 directory and proceeds.
> 
> After running .configure --prefix=/tmp [for testing] that' also goes fine,
> except .configure cannot find dlopen
> checking for dlopen in -ldl... no

dlopen is actually implemeted in the rtld - so you need to link at least
one shared lib (usually libc) to get it.

> make also fails when it comes time to link because of the dlopen although
> it's a part of FreeBSD libc

Check that you don't have -static or equivalent in CFLAGS/LDFLAGS.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


.configure && make fails to find ld [dlopen]

2017-07-05 Thread blubee blubeeme
I am porting some software and it's getting tripped up with dlopen.

I run autoreconf -fi and it asks me to add AC_CONFIG_MACRO_DIRS([m4]) to my
configure.ac file, which I do. It creates a ./m4 directory and proceeds.

After running .configure --prefix=/tmp [for testing] that' also goes fine,
except .configure cannot find dlopen
checking for dlopen in -ldl... no

make also fails when it comes time to link because of the dlopen although
it's a part of FreeBSD libc

manually running ld -ld I get this output: https://pastebin.com/Rzfajnk0

The relevant parts of my env looks like this: https://pastebin.com/uJJ7BqDg

Is there anything that I am missing why configure can't find ld?

Best,
Owen
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [base package build] [fail] r320347 -> r320392: install: builddir/Africa/Abidjan: No such file or directory

2017-07-05 Thread Bryan Drewery
On 7/5/17 12:55 PM, Boris Samorodov wrote:
> 05.07.2017 22:29, Bryan Drewery пишет:
> 
>> Parallel install should be working just fine.  It is a supported feature
>> of installworld.  What was the issue exactly?
> 
> https://lists.freebsd.org/pipermail/freebsd-current/2017-June/066408.html
> 
> As I understand, it was an installworld while base packages building.
> 
> But I suspect that META_MODE may be to blame. I've shitched it off
> since then.
> 

META_MODE is explicitly disabled during installworld so it shouldn't
have any impact.  I've had a few reports of issues on it though and will
investigate.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: [base package build] [fail] r320347 -> r320392: install: builddir/Africa/Abidjan: No such file or directory

2017-07-05 Thread Boris Samorodov
05.07.2017 22:29, Bryan Drewery пишет:

> Parallel install should be working just fine.  It is a supported feature
> of installworld.  What was the issue exactly?

https://lists.freebsd.org/pipermail/freebsd-current/2017-June/066408.html

As I understand, it was an installworld while base packages building.

But I suspect that META_MODE may be to blame. I've shitched it off
since then.

-- 
WBR, bsam



signature.asc
Description: OpenPGP digital signature


Re: [base package build] [fail] r320347 -> r320392: install: builddir/Africa/Abidjan: No such file or directory

2017-07-05 Thread Cy Schubert
In message <291c901c-7b78-7f4f-dd8d-d808406fb...@freebsd.org>, Bryan 
Drewery wr
ites:
> This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
> --UMVEimIc8tkOmRSqA1n5pHiCvanl0O7sJ
> Content-Type: multipart/mixed; boundary="lqMESdlFVuAvpHCbkFDFe9mUliTQ2oLlW";
>  protected-headers="v1"
> From: Bryan Drewery 
> To: Cy Schubert 
> Cc: Boris Samorodov , freebsd-current@freebsd.org,
>  b...@freebsd.org
> Message-ID: <291c901c-7b78-7f4f-dd8d-d808406fb...@freebsd.org>
> Subject: Re: [base package build] [fail] r320347 -> r320392: install:
>  builddir/Africa/Abidjan: No such file or directory
> References: <201706272014.v5rkej8l042...@slippy.cwsent.com>
> In-Reply-To: <201706272014.v5rkej8l042...@slippy.cwsent.com>
> 
> --lqMESdlFVuAvpHCbkFDFe9mUliTQ2oLlW
> Content-Type: text/plain; charset=utf-8
> Content-Language: en-US
> Content-Transfer-Encoding: quoted-printable
> 
> On 6/27/17 1:14 PM, Cy Schubert wrote:
> > In message <201706271956.v5rjujqp065...@slippy.cwsent.com>, Cy Schubert=
> =20
> > writes:
> >> In message <83207990-cd7c-90ea-6893-c0b3b1321...@passap.ru>, Boris=20
> >> Samorodov wr
> >> ites:
> >>> 27.06.2017 20:06, Trond Endrest=C3=83=C2=B8l =C3=90=C2=BF=C3=90=C2=B8=
> =C3=91=CB=86=C3=90=C2=B5=C3=91=E2=80=9A:
> >>>
>  Try running make installworld without -j N.
>  Serial installworld was successful at my end.
> >>>
> >>> Thank you, that helped.
> >>
> >> For users doing poudriere jail -c or poudriere jail -u, use -J 1, thou=
> gh=20
> >> poudriere should only perform parallel builds only, not parallel insta=
> lls.=20
> >> Parallel installs is simply asking for trouble regardless.
> >=20
> 
> Parallel install should be working just fine.  It is a supported feature
> of installworld.  What was the issue exactly?

I had some problems a few moths ago, maybe a year ago, I can't recall 
exactly. After a recent email exchange I decided to try again. It works 
now. I must have hit a rough spot at one point. I've updated my scripts to 
use parallel install again.

I'll raise a red flag next time rather than quietly adjusting what I do.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: emulators/qemu-user-static needs MAP_GUARD support

2017-07-05 Thread Alan Cox
On 07/05/2017 13:47, Guy Yur wrote:
> Hi Alan,
>
> On 1 July 2017 at 23:07, Alan Cox  wrote:
>> On Sat, Jul 1, 2017 at 2:46 PM, Guy Yur  wrote:
>>> Hi,
>>>
>>> I tried to run armv6 /bin/sh in a chroot on an
>>> amd64 host using qemu-arm-static.
>>> It failed on invalid argument to mmap.
>>>
>>> # cp /usr/local/bin/qemu-arm-static /chroots/armv6/root/
>>> # chroot /chroots/armv6 /root/qemu-arm-static /bin/sh
>>> /lib/libedit.so.7: mmap of entire address space failed: Invalid argument
>>>
>>> ... snipped
>>>
>> MAP_ANON should not be passed to mmap(2) at the same time as MAP_GUARD.
>> Passing MAP_FIXED at the same time is okay.
>>
> The problem is definitely in qemu user mode mmap emulation code.
> https://github.com/seanbruno/qemu-bsd-user/blob/bsd-user/bsd-user/mmap.c#L464
>
> qemu adds MAP_FIXED | MAP_ANONYMOUS if MAP_FIXED is not
> set in flags when the emulated mmap call is done.
> So rtld-elf passes MAP_GUARD and the kernel receives MAP_GUARD
> and MAP_ANON and rejects the call.
>
> Do you know if the MAP_ANONYMOUS is needed in the call?

Try removing the MAP_ANON (or MAP_ANONYMOUS).  Adding MAP_FIXED should
not imply the addition of MAP_ANON.

> I am currently using a workaround patch to convert
> MAP_GUARD to MAP_PRIVATE | MAP_ANON | MAP_NOCORE
> (like rtld-elf does if OS version doesn't support MAP_GUARD).
> https://github.com/guyyur/freebsd-ports_patches/blob/master/emulators_qemu-sbruno__MAP_GUARD_workaround.patch
> With the patch qemu-arm-static is working.
>
> I would prefer using a better fix that retains the MAP_GUARD protections.
>
> Thanks,
> Guy
>

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: [base package build] [fail] r320347 -> r320392: install: builddir/Africa/Abidjan: No such file or directory

2017-07-05 Thread Bryan Drewery
On 6/27/17 1:14 PM, Cy Schubert wrote:
> In message <201706271956.v5rjujqp065...@slippy.cwsent.com>, Cy Schubert 
> writes:
>> In message <83207990-cd7c-90ea-6893-c0b3b1321...@passap.ru>, Boris 
>> Samorodov wr
>> ites:
>>> 27.06.2017 20:06, Trond Endrestøl пишет:
>>>
 Try running make installworld without -j N.
 Serial installworld was successful at my end.
>>>
>>> Thank you, that helped.
>>
>> For users doing poudriere jail -c or poudriere jail -u, use -J 1, though 
>> poudriere should only perform parallel builds only, not parallel installs. 
>> Parallel installs is simply asking for trouble regardless.
> 

Parallel install should be working just fine.  It is a supported feature
of installworld.  What was the issue exactly?

> The patch I'm about to post here isn't quite correct. Either base or the 
> port's upstream should be patched to resolve this but this should help 
> someone somewhere.
> 
> Index: Makefile
> ===
> --- Makefile  (revision 444518)
> +++ Makefile  (working copy)
> @@ -2,7 +2,7 @@
>  
>  PORTNAME=poudriere
>  DISTVERSION= 3.1.19
> -PORTREVISION=0
> +PORTREVISION=1
>  CATEGORIES=  ports-mgmt
>  MASTER_SITES=LOCAL/bdrewery/${PORTNAME}/ \
>   http://mirror.shatow.net/freebsd/${PORTNAME}/ \
> Index: files/patch-src__share__poudriere__jail.sh
> ===
> --- files/patch-src__share__poudriere__jail.sh(nonexistent)
> +++ files/patch-src__share__poudriere__jail.sh(working copy)
> @@ -0,0 +1,27 @@
> +--- src/share/poudriere/jail.sh.orig 2017-06-01 10:21:58.0 -0700
>  src/share/poudriere/jail.sh  2017-06-27 13:06:20.548694000 -0700
> +@@ -272,21 +272,16 @@
> + }
> + 
> + installworld() {
> +-local make_jobs
> + local destdir="${JAILMNT}"
> + 
> +-if [ ${JAIL_OSVERSION} -gt 1100086 ]; then
> +-make_jobs="${MAKE_JOBS}"
> +-fi
> +-
> + msg "Starting make installworld"
> +-${MAKE_CMD} -C "${SRC_BASE}" ${make_jobs} installworld \
> ++${MAKE_CMD} -C "${SRC_BASE}"  installworld \
> + DESTDIR=${destdir} DB_FROM_SRC=1 || \
> + err 1 "Failed to 'make installworld'"
> +-${MAKE_CMD} -C "${SRC_BASE}" ${make_jobs} DESTDIR=${destdir} \
> ++${MAKE_CMD} -C "${SRC_BASE}" DESTDIR=${destdir} \
> + DB_FROM_SRC=1 distrib-dirs || \
> + err 1 "Failed to 'make distrib-dirs'"
> +-${MAKE_CMD} -C "${SRC_BASE}" ${make_jobs} DESTDIR=${destdir} \
> ++${MAKE_CMD} -C "${SRC_BASE}" DESTDIR=${destdir} \
> + distribution || err 1 "Failed to 'make distribution'"
> + 
> + return 0
> 
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: emulators/qemu-user-static needs MAP_GUARD support

2017-07-05 Thread Guy Yur
Hi Alan,

On 1 July 2017 at 23:07, Alan Cox  wrote:
>
> On Sat, Jul 1, 2017 at 2:46 PM, Guy Yur  wrote:
>>
>> Hi,
>>
>> I tried to run armv6 /bin/sh in a chroot on an
>> amd64 host using qemu-arm-static.
>> It failed on invalid argument to mmap.
>>
>> # cp /usr/local/bin/qemu-arm-static /chroots/armv6/root/
>> # chroot /chroots/armv6 /root/qemu-arm-static /bin/sh
>> /lib/libedit.so.7: mmap of entire address space failed: Invalid argument
>>
>> ... snipped
>>
>
> MAP_ANON should not be passed to mmap(2) at the same time as MAP_GUARD.
> Passing MAP_FIXED at the same time is okay.
>

The problem is definitely in qemu user mode mmap emulation code.
https://github.com/seanbruno/qemu-bsd-user/blob/bsd-user/bsd-user/mmap.c#L464

qemu adds MAP_FIXED | MAP_ANONYMOUS if MAP_FIXED is not
set in flags when the emulated mmap call is done.
So rtld-elf passes MAP_GUARD and the kernel receives MAP_GUARD
and MAP_ANON and rejects the call.

Do you know if the MAP_ANONYMOUS is needed in the call?

I am currently using a workaround patch to convert
MAP_GUARD to MAP_PRIVATE | MAP_ANON | MAP_NOCORE
(like rtld-elf does if OS version doesn't support MAP_GUARD).
https://github.com/guyyur/freebsd-ports_patches/blob/master/emulators_qemu-sbruno__MAP_GUARD_workaround.patch
With the patch qemu-arm-static is working.

I would prefer using a better fix that retains the MAP_GUARD protections.

Thanks,
Guy
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"