* Re: ./configure errors witn musl-gcc (zlib library conflict when building openssh)
2016-08-05 22:32 ./configure errors witn musl-gcc (zlib library conflict when building openssh) Assaf Gordon
@ 2016-08-05 23:08 ` Rich Felker
2016-08-05 23:26 ` Khem Raj
2016-08-05 23:33 ` Rich Felker
2 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2016-08-05 23:08 UTC (permalink / raw)
To: musl
On Fri, Aug 05, 2016 at 06:32:14PM -0400, Assaf Gordon wrote:
> Hello,
>
> I'm trying to build openssh on Ubuntu with musl-gcc, and encountered a problem during "./configure" due to required library (zlib) which causes conflicts between the system's glibc and musl-libc.
>
> There is probably a simple solution, but I couldn't find one.
>
> The system is Ubuntu 14.04 LTS, gcc 4.8.4.
> musl is 1.1.15 built from source, installed to /usr/local/musl .
>
> First, I build zlib using musl-gcc:
>
> wget http://zlib.net/zlib-1.2.8.tar.gz
> tar -xf zlib-1.2.8.tar.gz
> cd zlib-1.2.8
> CC=musl-gcc ./configure
> make
>
> This works well (note I did not install it with 'sudo make install').
>
> Second, I try to build openssh:
>
> git clone https://github.com/openssh/openssh-portable
> cd openssh-portable
> autoreconf -if
> CC=musl-gcc ./configure --without-stackprotect --with-zlib=/home/ubuntu/sources/zlib-1.2.8
> But this fails with:
>
> checking zlib.h usability... yes
> checking zlib.h presence... yes
> checking for zlib.h... yes
> checking for deflate in -lz... yes
> checking for possibly buggy zlib... yes
> configure: error: *** zlib too old - check config.log ***
> Your reported zlib version has known security problems. It's possible your
> vendor has fixed these problems without changing the version number. If you
> are sure this is the case, you can disable the check by running
> "./configure --without-zlib-version-check".
> If you are in doubt, upgrade zlib to version 1.2.3 or greater.
> See http://www.gzip.org/zlib/ for details.
>
> The problem is not that zlib is "too old", but that the wrong shard-object is used (it uses the system's one).
> From config.log:
>
> configure:9002: checking for possibly buggy zlib
> configure:9041: musl-gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -I/home/ubuntu/sources/zlib-1.2.8 -L/home/ubuntu/sources/zlib-1.2.8 -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack conftest.c -lz >&5
> configure:9041: $? = 0
> configure:9041: ./conftest
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __snprintf_chk: symbol not found
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __vsnprintf_chk: symbol not found
> configure:9041: $? = 127
> configure: program exited with status 127
Somehow musl-gcc is not correctly replacing the compiler's builtin
library path. It's likely something weird Ubuntu's gcc build is doing
for their multilib/multiarch support, but hard to say specifically
what. Can you build a hello world program succesfully? What does
musl-gcc -v hello.c say, given a hello world program hello.c?
Rich
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ./configure errors witn musl-gcc (zlib library conflict when building openssh)
2016-08-05 22:32 ./configure errors witn musl-gcc (zlib library conflict when building openssh) Assaf Gordon
2016-08-05 23:08 ` Rich Felker
@ 2016-08-05 23:26 ` Khem Raj
2016-08-05 23:30 ` Rich Felker
2016-08-05 23:33 ` Rich Felker
2 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2016-08-05 23:26 UTC (permalink / raw)
To: musl
On 16-08-05 18:32:14, Assaf Gordon wrote:
> Hello,
>
> I'm trying to build openssh on Ubuntu with musl-gcc, and encountered a problem during "./configure" due to required library (zlib) which causes conflicts between the system's glibc and musl-libc.
>
> There is probably a simple solution, but I couldn't find one.
>
> The system is Ubuntu 14.04 LTS, gcc 4.8.4.
> musl is 1.1.15 built from source, installed to /usr/local/musl .
>
> First, I build zlib using musl-gcc:
>
> wget http://zlib.net/zlib-1.2.8.tar.gz
> tar -xf zlib-1.2.8.tar.gz
> cd zlib-1.2.8
> CC=musl-gcc ./configure
> make
>
> This works well (note I did not install it with 'sudo make install').
>
> Second, I try to build openssh:
>
> git clone https://github.com/openssh/openssh-portable
> cd openssh-portable
> autoreconf -if
> CC=musl-gcc ./configure --without-stackprotect --with-zlib=/home/ubuntu/sources/zlib-1.2.8
I think you need to point it to a staged install of zlib, so may be run make DESTDIR="some/location" install
when building zlib
> But this fails with:
>
> checking zlib.h usability... yes
> checking zlib.h presence... yes
> checking for zlib.h... yes
> checking for deflate in -lz... yes
> checking for possibly buggy zlib... yes
> configure: error: *** zlib too old - check config.log ***
> Your reported zlib version has known security problems. It's possible your
> vendor has fixed these problems without changing the version number. If you
> are sure this is the case, you can disable the check by running
> "./configure --without-zlib-version-check".
> If you are in doubt, upgrade zlib to version 1.2.3 or greater.
> See http://www.gzip.org/zlib/ for details.
>
> The problem is not that zlib is "too old", but that the wrong shard-object is used (it uses the system's one).
> From config.log:
>
> configure:9002: checking for possibly buggy zlib
> configure:9041: musl-gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -I/home/ubuntu/sources/zlib-1.2.8 -L/home/ubuntu/sources/zlib-1.2.8 -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack conftest.c -lz >&5
> configure:9041: $? = 0
> configure:9041: ./conftest
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __snprintf_chk: symbol not found
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __vsnprintf_chk: symbol not found
> configure:9041: $? = 127
> configure: program exited with status 127
>
> If I try to force LD_LIBRARY_PATH, this messes up the entire compilation:
>
> $ export LD_LIBRARY_PATH="/home/ubuntu/sources/zlib-1.2.8:$LD_LIBRARY_PATH"
> $ CC=musl-gcc ./configure --without-stackprotect --with-zlib=/home/ubuntu/sources/zlib-1.2.8
> checking for gcc... musl-gcc
> checking whether the C compiler works... no
> configure: error: in `/home/ubuntu/openssh-portable':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
>
> From 'config.log':
>
> configure:2963: checking whether the C compiler works
> configure:2985: musl-gcc conftest.c >&5
> /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1: error while loading shared libraries: /usr/lib/x86_64-linux-gnu/libc.so: invalid ELF header
> configure:2989: $? = 1
> configure:3027: result: no
>
>
> As an alternative I also tried installing zlib in /usr/local/musl/lib - but it gives the same kind of erros once LD_LIBRARY_PATH is modified.
>
> Any suggestions are very welcomed,
> thanks,
> - assaf
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ./configure errors witn musl-gcc (zlib library conflict when building openssh)
2016-08-05 23:26 ` Khem Raj
@ 2016-08-05 23:30 ` Rich Felker
0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2016-08-05 23:30 UTC (permalink / raw)
To: musl
On Fri, Aug 05, 2016 at 04:26:05PM -0700, Khem Raj wrote:
> On 16-08-05 18:32:14, Assaf Gordon wrote:
> > Hello,
> >
> > I'm trying to build openssh on Ubuntu with musl-gcc, and encountered a problem during "./configure" due to required library (zlib) which causes conflicts between the system's glibc and musl-libc.
> >
> > There is probably a simple solution, but I couldn't find one.
> >
> > The system is Ubuntu 14.04 LTS, gcc 4.8.4.
> > musl is 1.1.15 built from source, installed to /usr/local/musl .
> >
> > First, I build zlib using musl-gcc:
> >
> > wget http://zlib.net/zlib-1.2.8.tar.gz
> > tar -xf zlib-1.2.8.tar.gz
> > cd zlib-1.2.8
> > CC=musl-gcc ./configure
> > make
> >
> > This works well (note I did not install it with 'sudo make install').
> >
> > Second, I try to build openssh:
> >
> > git clone https://github.com/openssh/openssh-portable
> > cd openssh-portable
> > autoreconf -if
> > CC=musl-gcc ./configure --without-stackprotect --with-zlib=/home/ubuntu/sources/zlib-1.2.8
>
> I think you need to point it to a staged install of zlib, so may be run make DESTDIR="some/location" install
> when building zlib
That may also be true, but if so, the result of failure to do so
should be failure to find the library at all, not using a
glibc-ecosystem copy of library.
Rich
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ./configure errors witn musl-gcc (zlib library conflict when building openssh)
2016-08-05 22:32 ./configure errors witn musl-gcc (zlib library conflict when building openssh) Assaf Gordon
2016-08-05 23:08 ` Rich Felker
2016-08-05 23:26 ` Khem Raj
@ 2016-08-05 23:33 ` Rich Felker
2016-08-13 3:57 ` Assaf Gordon
2 siblings, 1 reply; 6+ messages in thread
From: Rich Felker @ 2016-08-05 23:33 UTC (permalink / raw)
To: musl
On Fri, Aug 05, 2016 at 06:32:14PM -0400, Assaf Gordon wrote:
> Hello,
>
> I'm trying to build openssh on Ubuntu with musl-gcc, and encountered a problem during "./configure" due to required library (zlib) which causes conflicts between the system's glibc and musl-libc.
>
> There is probably a simple solution, but I couldn't find one.
>
> The system is Ubuntu 14.04 LTS, gcc 4.8.4.
> musl is 1.1.15 built from source, installed to /usr/local/musl .
>
> First, I build zlib using musl-gcc:
>
> wget http://zlib.net/zlib-1.2.8.tar.gz
> tar -xf zlib-1.2.8.tar.gz
> cd zlib-1.2.8
> CC=musl-gcc ./configure
> make
>
> This works well (note I did not install it with 'sudo make install').
>
> Second, I try to build openssh:
>
> git clone https://github.com/openssh/openssh-portable
> cd openssh-portable
> autoreconf -if
> CC=musl-gcc ./configure --without-stackprotect --with-zlib=/home/ubuntu/sources/zlib-1.2.8
> But this fails with:
>
> checking zlib.h usability... yes
> checking zlib.h presence... yes
> checking for zlib.h... yes
> checking for deflate in -lz... yes
> checking for possibly buggy zlib... yes
> configure: error: *** zlib too old - check config.log ***
> Your reported zlib version has known security problems. It's possible your
> vendor has fixed these problems without changing the version number. If you
> are sure this is the case, you can disable the check by running
> "./configure --without-zlib-version-check".
> If you are in doubt, upgrade zlib to version 1.2.3 or greater.
> See http://www.gzip.org/zlib/ for details.
>
> The problem is not that zlib is "too old", but that the wrong shard-object is used (it uses the system's one).
> From config.log:
>
> configure:9002: checking for possibly buggy zlib
> configure:9041: musl-gcc -o conftest -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -I/home/ubuntu/sources/zlib-1.2.8 -L/home/ubuntu/sources/zlib-1.2.8 -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack conftest.c -lz >&5
> configure:9041: $? = 0
> configure:9041: ./conftest
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __snprintf_chk: symbol not found
> Error relocating /lib/x86_64-linux-gnu/libz.so.1: __vsnprintf_chk: symbol not found
> configure:9041: $? = 127
> configure: program exited with status 127
Ah, I missed that this is a _runtime_ failure, not a linking failure.
The problem is just that you don't have an /etc/ld-musl-x86_64.path
file, so musl is using the default library paths which are only
suitable for a musl-based system. Create that file and put the paths
to your musl-linked libs there. Or, alternatively, use static linking.
Dynamic linking musl is really not ideal when your system libc is
glibc.
Rich
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ./configure errors witn musl-gcc (zlib library conflict when building openssh)
2016-08-05 23:33 ` Rich Felker
@ 2016-08-13 3:57 ` Assaf Gordon
0 siblings, 0 replies; 6+ messages in thread
From: Assaf Gordon @ 2016-08-13 3:57 UTC (permalink / raw)
To: musl
> On Aug 5, 2016, at 19:33, Rich Felker <dalias@libc.org> wrote:
>
> On Fri, Aug 05, 2016 at 06:32:14PM -0400, Assaf Gordon wrote:
>> I'm trying to build openssh on Ubuntu with musl-gcc, and encountered a problem during "./configure" due to required library (zlib) which causes conflicts between the system's glibc and musl-libc.
> [...] alternatively, use static linking.
> Dynamic linking musl is really not ideal when your system libc is
> glibc.
Thank you for all the information. Linking as static executable indeed worked well.
- assaf`
^ permalink raw reply [flat|nested] 6+ messages in thread