mailing list of musl libc
 help / color / Atom feed
* gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os on Alpine Linux 3.10.3
@ 2019-12-30 11:24 Scherbatiy Alexander
  2019-12-30 16:54 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Scherbatiy Alexander @ 2019-12-30 11:24 UTC (permalink / raw)
  To: musl

Hello,

gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os variable on Alpine Linux 3.10.3.

Here is a snippet from the configure.ac file which I tested in docker alpine:3.10.3
----------------
AC_CANONICAL_BUILD
AC_MSG_NOTICE([build_os=$build_os])
----------------
Output:
----------------
checking build system type... x86_64-pc-linux-gnu
configure: build_os=linux-gnu
----------------

The same code on Alpine 3.8.4 (docker alpine:3.8 ) returns:
----------------
checking build system type... x86_64-pc-linux-musl
configure: build_os=linux-musl
----------------

Is it expected that build_os is detected as linux-gnu instead of linux-musl on Alpine 3.0.3?

Thanks,
Alexander.

Simple project:

--- configure.ac ---
AC_INIT([amhello], [1.0], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

# Environment
AC_CANONICAL_BUILD
AC_MSG_NOTICE([build_os=$build_os])

AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
 Makefile
])
AC_OUTPUT

--- Makefile.am ---
bin_PROGRAMS = hello
hello_SOURCES = main.c

--- Makefile.am ---
bin_PROGRAMS = hello
hello_SOURCES = main.c
/tmp/sample/autoconf-sample # cat main.c 
#include <config.h>
#include <stdio.h>

int main (void)
{
  printf("Hello World!\n");
  return 0;
}

----------------
autoreconf -i
./configure



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os on Alpine Linux 3.10.3
  2019-12-30 11:24 gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os on Alpine Linux 3.10.3 Scherbatiy Alexander
@ 2019-12-30 16:54 ` Rich Felker
  2020-01-10 12:34   ` Alexander Scherbatiy
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2019-12-30 16:54 UTC (permalink / raw)
  To: musl

On Mon, Dec 30, 2019 at 02:24:56PM +0300, Scherbatiy Alexander wrote:
> Hello,
> 
> gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os variable on Alpine Linux 3.10.3.
> 
> Here is a snippet from the configure.ac file which I tested in docker alpine:3.10.3
> ----------------
> AC_CANONICAL_BUILD
> AC_MSG_NOTICE([build_os=$build_os])
> ----------------
> Output:
> ----------------
> checking build system type... x86_64-pc-linux-gnu
> configure: build_os=linux-gnu
> ----------------
> 
> The same code on Alpine 3.8.4 (docker alpine:3.8 ) returns:
> ----------------
> checking build system type... x86_64-pc-linux-musl
> configure: build_os=linux-musl
> ----------------
> 
> Is it expected that build_os is detected as linux-gnu instead of linux-musl on Alpine 3.0.3?

Where was autoconf run to generate the configure script? Production of
linux-musl tuples is a new behavior in recent autoconf, and whether it
happens depends on what version of autoconf was used to build the
configure script, not what versions of software are present where the
configure script runs.

Use of this result is almost certainly a bug/misuse of configure. Run
a configure test for whatever property you're depending on, not
whether the name is linux-musl vs linux-gnu.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os on Alpine Linux 3.10.3
  2019-12-30 16:54 ` Rich Felker
@ 2020-01-10 12:34   ` Alexander Scherbatiy
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Scherbatiy @ 2020-01-10 12:34 UTC (permalink / raw)
  To: musl, Rich Felker

On 30.12.2019 19:54, Rich Felker wrote:

> On Mon, Dec 30, 2019 at 02:24:56PM +0300, Scherbatiy Alexander wrote:
>> Hello,
>>
>> gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os variable on Alpine Linux 3.10.3.
>>
>> Here is a snippet from the configure.ac file which I tested in docker alpine:3.10.3
>> ----------------
>> AC_CANONICAL_BUILD
>> AC_MSG_NOTICE([build_os=$build_os])
>> ----------------
>> Output:
>> ----------------
>> checking build system type... x86_64-pc-linux-gnu
>> configure: build_os=linux-gnu
>> ----------------
>>
>> The same code on Alpine 3.8.4 (docker alpine:3.8 ) returns:
>> ----------------
>> checking build system type... x86_64-pc-linux-musl
>> configure: build_os=linux-musl
>> ----------------
>>
>> Is it expected that build_os is detected as linux-gnu instead of linux-musl on Alpine 3.0.3?
> Where was autoconf run to generate the configure script? Production of
> linux-musl tuples is a new behavior in recent autoconf, and whether it
> happens depends on what version of autoconf was used to build the
> configure script, not what versions of software are present where the
> configure script runs.

Below are outputs of running autoconf on Alpine Linux in docker.

The used autoconf (GNU Autoconf) version is 2.69.

Alpine Linux 3.10.3:

----------

 > docker run --rm -it alpine:3.10.3

 > apk add autoconf automake
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch 
http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/5) Installing m4 (1.4.18-r1)
(2/5) Installing libbz2 (1.0.6-r7)
(3/5) Installing perl (5.28.2-r1)
(4/5) Installing autoconf (2.69-r2)
(5/5) Installing automake (1.16.1-r0)
Executing busybox-1.30.1-r2.trigger
OK: 47 MiB in 19 packages

 > autoreconf -i
 > ./configure
...
configure: build_os=linux-gnu

----------

Alpine Linux 3.8.4:

----------

 > docker run --rm -it alpine:3.8.4

 > apk add autoconf automake
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch 
http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/5) Installing m4 (1.4.18-r1)
(2/5) Installing libbz2 (1.0.6-r7)
(3/5) Installing perl (5.26.3-r0)
(4/5) Installing autoconf (2.69-r2)
(5/5) Installing automake (1.16.1-r0)
Executing busybox-1.28.4-r3.trigger
OK: 45 MiB in 18 packages

 > autoreconf -i
 > ./configure
...
configure: build_os=linux-musl
----------

> Use of this result is almost certainly a bug/misuse of configure. Run
> a configure test for whatever property you're depending on, not
> whether the name is linux-musl vs linux-gnu.

The port of OpenJDK to Alpine Linux project Portola uses 
AC_CANONICAL_BUILD  autoconf property to set HOTSPOT_LIBC property [1].

What is the right way to define which libc should be used in this case?

[1] 
https://hg.openjdk.java.net/portola/portola/file/c4a7cf80a3bd/make/autoconf/platform.m4#l209

Thanks,

Alexander.

> Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 11:24 gnu autoconf AC_CANONICAL_BUILD returns linux-gnu build_os on Alpine Linux 3.10.3 Scherbatiy Alexander
2019-12-30 16:54 ` Rich Felker
2020-01-10 12:34   ` Alexander Scherbatiy

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git