mailing list of musl libc
 help / color / mirror / code / Atom feed
* Problem with musl-gcc script. Is it bad installation?
@ 2016-03-05 22:28 John Found
  2016-03-06  0:36 ` Rich Felker
  0 siblings, 1 reply; 14+ messages in thread
From: John Found @ 2016-03-05 22:28 UTC (permalink / raw)
  To: musl mainling list

Well, after compiling and installing musl (i386) (and everything seems to be ok),
I set the path with:

export PATH=/usr/local/musl/bin:$PATH

and tried to start the musl-gss. In result I got an error:

/usr/local/musl/bin/musl-gcc: line 2: exec: gcc -m32: not found

When attempt to compile configure and compile something with:

CC=musl-gcc ./configure --prefix=/usr/local/musl

The result is the error:

configure: error: C compiler cannot create executables

So, how to proceed further?

Cheers
-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-05 22:28 Problem with musl-gcc script. Is it bad installation? John Found
@ 2016-03-06  0:36 ` Rich Felker
  2016-03-06  0:51   ` Szabolcs Nagy
  2016-03-06  1:02   ` John Found
  0 siblings, 2 replies; 14+ messages in thread
From: Rich Felker @ 2016-03-06  0:36 UTC (permalink / raw)
  To: musl

On Sun, Mar 06, 2016 at 12:28:23AM +0200, John Found wrote:
> Well, after compiling and installing musl (i386) (and everything seems to be ok),
> I set the path with:
> 
> export PATH=/usr/local/musl/bin:$PATH
> 
> and tried to start the musl-gss. In result I got an error:
> 
> /usr/local/musl/bin/musl-gcc: line 2: exec: gcc -m32: not found
> 
> When attempt to compile configure and compile something with:
> 
> CC=musl-gcc ./configure --prefix=/usr/local/musl
> 
> The result is the error:
> 
> configure: error: C compiler cannot create executables
> 
> So, how to proceed further?

The musl-gcc script is limited in its usefulness, and was not really
designed/tested for repurposing an existing x86_64 gcc as an i386-musl
one. You should be able to make it work though by editing the musl-gcc
script to remove the double quotes around "${REALGCC:-...}". If that
works for you, this is possibly a change we should make upstream.

Rich


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  0:36 ` Rich Felker
@ 2016-03-06  0:51   ` Szabolcs Nagy
  2016-03-06  1:02   ` John Found
  1 sibling, 0 replies; 14+ messages in thread
From: Szabolcs Nagy @ 2016-03-06  0:51 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2016-03-05 19:36:09 -0500]:
> On Sun, Mar 06, 2016 at 12:28:23AM +0200, John Found wrote:
> > Well, after compiling and installing musl (i386) (and everything seems to be ok),
> > I set the path with:
> > 
> > export PATH=/usr/local/musl/bin:$PATH
> > 
> > and tried to start the musl-gss. In result I got an error:
> > 
> > /usr/local/musl/bin/musl-gcc: line 2: exec: gcc -m32: not found
> > 
> > When attempt to compile configure and compile something with:
> > 
> > CC=musl-gcc ./configure --prefix=/usr/local/musl
> > 
> > The result is the error:
> > 
> > configure: error: C compiler cannot create executables
> > 
> > So, how to proceed further?
> 
> The musl-gcc script is limited in its usefulness, and was not really
> designed/tested for repurposing an existing x86_64 gcc as an i386-musl
> one. You should be able to make it work though by editing the musl-gcc
> script to remove the double quotes around "${REALGCC:-...}". If that
> works for you, this is possibly a change we should make upstream.
> 

this came up a year ago
http://www.openwall.com/lists/musl/2015/03/11/10


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  0:36 ` Rich Felker
  2016-03-06  0:51   ` Szabolcs Nagy
@ 2016-03-06  1:02   ` John Found
  2016-03-06  1:09     ` Szabolcs Nagy
  1 sibling, 1 reply; 14+ messages in thread
From: John Found @ 2016-03-06  1:02 UTC (permalink / raw)
  To: musl

On Sat, 5 Mar 2016 19:36:09 -0500
Rich Felker <dalias@libc.org> wrote:

> The musl-gcc script is limited in its usefulness, and was not really
> designed/tested for repurposing an existing x86_64 gcc as an i386-musl
> one. You should be able to make it work though by editing the musl-gcc
> script to remove the double quotes around "${REALGCC:-...}". If that
> works for you, this is possibly a change we should make upstream.
> 
> Rich

After the suggested change, I can start musl-gcc and it even accepts some commands as --help
But trying to use it with ./configure script again fails with:

checking for gcc... musl-gcc
checking whether the C compiler works... no
configure: error: in `/work/cwork/SQLite/sqlite-autoconf-3110100':
configure: error: C compiler cannot create executables
See `config.log' for more details

In the config.log I found the following:

configure:3234: musl-gcc    conftest.c  >&5
/usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
configure:3238: $? = 1
configure:3276: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "sqlite"
| #define PACKAGE_TARNAME "sqlite"
| #define PACKAGE_VERSION "3.11.1"
| #define PACKAGE_STRING "sqlite 3.11.1"
| #define PACKAGE_BUGREPORT "http://www.sqlite.org"
| #define PACKAGE_URL ""
| #define PACKAGE "sqlite"
| #define VERSION "3.11.1"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }


Regards
-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  1:02   ` John Found
@ 2016-03-06  1:09     ` Szabolcs Nagy
  2016-03-06  1:14       ` Szabolcs Nagy
  2016-03-06  1:15       ` John Found
  0 siblings, 2 replies; 14+ messages in thread
From: Szabolcs Nagy @ 2016-03-06  1:09 UTC (permalink / raw)
  To: musl

* John Found <johnfound@asm32.info> [2016-03-06 03:02:30 +0200]:

> On Sat, 5 Mar 2016 19:36:09 -0500
> Rich Felker <dalias@libc.org> wrote:
> 
> > The musl-gcc script is limited in its usefulness, and was not really
> > designed/tested for repurposing an existing x86_64 gcc as an i386-musl
> > one. You should be able to make it work though by editing the musl-gcc
> > script to remove the double quotes around "${REALGCC:-...}". If that
> > works for you, this is possibly a change we should make upstream.
> > 
> > Rich
> 
> After the suggested change, I can start musl-gcc and it even accepts some commands as --help
> But trying to use it with ./configure script again fails with:
> 
> checking for gcc... musl-gcc
> checking whether the C compiler works... no
> configure: error: in `/work/cwork/SQLite/sqlite-autoconf-3110100':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
> 
> In the config.log I found the following:
> 
> configure:3234: musl-gcc    conftest.c  >&5
> /usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.so when searching for -lc
> /usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.a when searching for -lc
> /usr/bin/ld: cannot find -lc
> collect2: error: ld returned 1 exit status

your gcc toolchain does not support -m32
because it's missing i386 gcc runtime libraries.

install the appropriate i386 libgcc package or
get a proper i386 toolchain.

> configure:3238: $? = 1
> configure:3276: result: no
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "sqlite"
> | #define PACKAGE_TARNAME "sqlite"
> | #define PACKAGE_VERSION "3.11.1"
> | #define PACKAGE_STRING "sqlite 3.11.1"
> | #define PACKAGE_BUGREPORT "http://www.sqlite.org"
> | #define PACKAGE_URL ""
> | #define PACKAGE "sqlite"
> | #define VERSION "3.11.1"
> | /* end confdefs.h.  */
> | 
> | int
> | main ()
> | {
> | 
> |   ;
> |   return 0;
> | }
> 
> 
> Regards
> -- 
> http://fresh.flatassembler.net
> http://asm32.info
> John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  1:09     ` Szabolcs Nagy
@ 2016-03-06  1:14       ` Szabolcs Nagy
  2016-03-06  1:15       ` John Found
  1 sibling, 0 replies; 14+ messages in thread
From: Szabolcs Nagy @ 2016-03-06  1:14 UTC (permalink / raw)
  To: musl

* Szabolcs Nagy <nsz@port70.net> [2016-03-06 02:09:07 +0100]:
> * John Found <johnfound@asm32.info> [2016-03-06 03:02:30 +0200]:
> 
> > On Sat, 5 Mar 2016 19:36:09 -0500
> > Rich Felker <dalias@libc.org> wrote:
> > 
> > > The musl-gcc script is limited in its usefulness, and was not really
> > > designed/tested for repurposing an existing x86_64 gcc as an i386-musl
> > > one. You should be able to make it work though by editing the musl-gcc
> > > script to remove the double quotes around "${REALGCC:-...}". If that
> > > works for you, this is possibly a change we should make upstream.
> > > 
> > > Rich
> > 
> > After the suggested change, I can start musl-gcc and it even accepts some commands as --help
> > But trying to use it with ./configure script again fails with:
> > 
> > checking for gcc... musl-gcc
> > checking whether the C compiler works... no
> > configure: error: in `/work/cwork/SQLite/sqlite-autoconf-3110100':
> > configure: error: C compiler cannot create executables
> > See `config.log' for more details
> > 
> > In the config.log I found the following:
> > 
> > configure:3234: musl-gcc    conftest.c  >&5
> > /usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.so when searching for -lc
> > /usr/bin/ld: skipping incompatible /usr/local/musl/lib/libc.a when searching for -lc
> > /usr/bin/ld: cannot find -lc
> > collect2: error: ld returned 1 exit status
> 
> your gcc toolchain does not support -m32
> because it's missing i386 gcc runtime libraries.
> 
> install the appropriate i386 libgcc package or
> get a proper i386 toolchain.
> 

on a second thought that would prevent the musl build too,

i think musl-gcc does not pass the -Wl,-melf_i386 to the linker

> > configure:3238: $? = 1
> > configure:3276: result: no
> > configure: failed program was:
> > | /* confdefs.h */
> > | #define PACKAGE_NAME "sqlite"
> > | #define PACKAGE_TARNAME "sqlite"
> > | #define PACKAGE_VERSION "3.11.1"
> > | #define PACKAGE_STRING "sqlite 3.11.1"
> > | #define PACKAGE_BUGREPORT "http://www.sqlite.org"
> > | #define PACKAGE_URL ""
> > | #define PACKAGE "sqlite"
> > | #define VERSION "3.11.1"
> > | /* end confdefs.h.  */
> > | 
> > | int
> > | main ()
> > | {
> > | 
> > |   ;
> > |   return 0;
> > | }
> > 
> > 
> > Regards
> > -- 
> > http://fresh.flatassembler.net
> > http://asm32.info
> > John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  1:09     ` Szabolcs Nagy
  2016-03-06  1:14       ` Szabolcs Nagy
@ 2016-03-06  1:15       ` John Found
  2016-03-06  1:18         ` Szabolcs Nagy
  1 sibling, 1 reply; 14+ messages in thread
From: John Found @ 2016-03-06  1:15 UTC (permalink / raw)
  To: musl

On Sun, 6 Mar 2016 02:09:07 +0100
Szabolcs Nagy <nsz@port70.net> wrote:

> your gcc toolchain does not support -m32
> because it's missing i386 gcc runtime libraries.
> 
> install the appropriate i386 libgcc package or
> get a proper i386 toolchain.

But how then I compiled musl to i386 target with the same gcc compiler?

-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  1:15       ` John Found
@ 2016-03-06  1:18         ` Szabolcs Nagy
  2016-03-06  2:20           ` James B
  0 siblings, 1 reply; 14+ messages in thread
From: Szabolcs Nagy @ 2016-03-06  1:18 UTC (permalink / raw)
  To: musl

* John Found <johnfound@asm32.info> [2016-03-06 03:15:05 +0200]:
> On Sun, 6 Mar 2016 02:09:07 +0100
> Szabolcs Nagy <nsz@port70.net> wrote:
> 
> > your gcc toolchain does not support -m32
> > because it's missing i386 gcc runtime libraries.
> > 
> > install the appropriate i386 libgcc package or
> > get a proper i386 toolchain.
> 
> But how then I compiled musl to i386 target with the same gcc compiler?
> 

gcc -m32 is a hack.. you will find more brokenness
if you keep using it instead of using an i386
cross toolchain.



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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  1:18         ` Szabolcs Nagy
@ 2016-03-06  2:20           ` James B
  2016-03-06  2:33             ` Rich Felker
  2016-03-06  7:30             ` John Found
  0 siblings, 2 replies; 14+ messages in thread
From: James B @ 2016-03-06  2:20 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]


On Sun, 6 Mar 2016 02:18:25 +0100
Szabolcs Nagy <nsz@port70.net> wrote:

> 
> gcc -m32 is a hack.. you will find more brokenness
> if you keep using it instead of using an i386
> cross toolchain.
> 

I use this spec file running 32-bit musl on 64-bit env ... it seems to work for making simple binaries.
(PS: there are hardcoded paths there, I installed 32-bit musl to /usr/musl32).

cheers!

-- 
James B <jamesbond3142@gmail.com>

[-- Attachment #2: musl-gcc.specs --]
[-- Type: application/octet-stream, Size: 693 bytes --]

*asm:
--32

%rename cpp_options old_cpp_options

*cpp_options:
-nostdinc -isystem /usr/musl32/include -isystem include%s %(old_cpp_options)

*cc1:
%(cc1_cpu) -m32 -nostdinc -isystem /usr/musl32/include -isystem include%s

*link_libgcc:
-L/usr/musl32/lib -L .%s

*libgcc:
32/libgcc.a%s %:if-exists(32/libgcc_eh.a%s)

*startfile:
%{!shared: /usr/musl32/lib/%{pie:S}crt1.o} /usr/musl32/lib/crti.o %{shared|pie:crtbeginS.o%s;:32/crtbegin.o%s}

*endfile:
%{shared|pie:crtendS.o%s;:32/crtend.o%s} /usr/musl32/lib/crtn.o

*link:
-m elf_i386 -dynamic-linker /ld-musl-i386.so.1 -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}

*esp_link:


*esp_options:


*esp_cpp_options:



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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  2:20           ` James B
@ 2016-03-06  2:33             ` Rich Felker
  2016-03-06 13:07               ` James B
  2016-03-06  7:30             ` John Found
  1 sibling, 1 reply; 14+ messages in thread
From: Rich Felker @ 2016-03-06  2:33 UTC (permalink / raw)
  To: musl

On Sun, Mar 06, 2016 at 01:20:53PM +1100, James B wrote:
> 
> On Sun, 6 Mar 2016 02:18:25 +0100
> Szabolcs Nagy <nsz@port70.net> wrote:
> 
> > 
> > gcc -m32 is a hack.. you will find more brokenness
> > if you keep using it instead of using an i386
> > cross toolchain.
> > 
> 
> I use this spec file running 32-bit musl on 64-bit env ... it seems to work for making simple binaries.
> (PS: there are hardcoded paths there, I installed 32-bit musl to /usr/musl32).
> 
> cheers!
> 
> -- 
> James B <jamesbond3142@gmail.com>

> *asm:
> --32
> 
> %rename cpp_options old_cpp_options
> 
> *cpp_options:
> -nostdinc -isystem /usr/musl32/include -isystem include%s %(old_cpp_options)
> 
> *cc1:
> %(cc1_cpu) -m32 -nostdinc -isystem /usr/musl32/include -isystem include%s
> 
> *link_libgcc:
> -L/usr/musl32/lib -L .%s
> 
> *libgcc:
> 32/libgcc.a%s %:if-exists(32/libgcc_eh.a%s)
> 
> *startfile:
> %{!shared: /usr/musl32/lib/%{pie:S}crt1.o} /usr/musl32/lib/crti.o %{shared|pie:crtbeginS.o%s;:32/crtbegin.o%s}
> 
> *endfile:
> %{shared|pie:crtendS.o%s;:32/crtend.o%s} /usr/musl32/lib/crtn.o
> 
> *link:
> -m elf_i386 -dynamic-linker /ld-musl-i386.so.1 -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}

That should be /lib/ld-musl-i386.so.1

Rich


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  2:20           ` James B
  2016-03-06  2:33             ` Rich Felker
@ 2016-03-06  7:30             ` John Found
  2016-03-06 13:07               ` James B
  1 sibling, 1 reply; 14+ messages in thread
From: John Found @ 2016-03-06  7:30 UTC (permalink / raw)
  To: musl

On Sun, 6 Mar 2016 13:20:53 +1100
James B <jamesbond3142@gmail.com> wrote:

> 
> I use this spec file running 32-bit musl on 64-bit env ... it seems to work for making simple binaries.
> (PS: there are hardcoded paths there, I installed 32-bit musl to /usr/musl32).
> 

After fixing the hardcoded parts with my hardcoded one, this spec file works great,
at least for sqlite library with its configure script.

Thanks!

-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@asm32.info>


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  2:33             ` Rich Felker
@ 2016-03-06 13:07               ` James B
  0 siblings, 0 replies; 14+ messages in thread
From: James B @ 2016-03-06 13:07 UTC (permalink / raw)
  To: musl

On Sat, 5 Mar 2016 21:33:20 -0500
Rich Felker <dalias@libc.org> wrote:

> 
> That should be /lib/ld-musl-i386.so.1

Thanks Rich, I missed that. I usually use musl for static binaries so the wrong dynamic loader isn't immediately obvious.




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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06  7:30             ` John Found
@ 2016-03-06 13:07               ` James B
  2016-03-06 13:26                 ` John Found
  0 siblings, 1 reply; 14+ messages in thread
From: James B @ 2016-03-06 13:07 UTC (permalink / raw)
  To: musl

On Sun, 6 Mar 2016 09:30:01 +0200
John Found <johnfound@asm32.info> wrote:

> 
> After fixing the hardcoded parts with my hardcoded one, this spec file works great,
> at least for sqlite library with its configure script.
> 
> Thanks!
> 

Glad it that it works.

James


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

* Re: Problem with musl-gcc script. Is it bad installation?
  2016-03-06 13:07               ` James B
@ 2016-03-06 13:26                 ` John Found
  0 siblings, 0 replies; 14+ messages in thread
From: John Found @ 2016-03-06 13:26 UTC (permalink / raw)
  To: musl

On Mon, 7 Mar 2016 00:07:55 +1100
James B <jamesbond3142@gmail.com> wrote:

> On Sun, 6 Mar 2016 09:30:01 +0200
> John Found <johnfound@asm32.info> wrote:
> 
> > 
> > After fixing the hardcoded parts with my hardcoded one, this spec file works great,
> > at least for sqlite library with its configure script.
> > 
> > Thanks!
> > 
> 
> Glad it that it works.
> 
> James

:) If someone is interested, I use sqlite3 library, together with assembly language written
32 bit CGI scripts on 64 bit Linux Apache server, *without* installed 32 bit libraries. :)

I am writing web forum engine this way. 
You can see the progress at http://board.asm32.info (for now it is almost nothing, but works. :D)

BTW, I am using the dynamic loader in a form of: "./ld-musl-i386.so" in my executables, because on the web server I don't have access to the system directories.

Best Regards

-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@asm32.info>


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

end of thread, other threads:[~2016-03-06 13:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-05 22:28 Problem with musl-gcc script. Is it bad installation? John Found
2016-03-06  0:36 ` Rich Felker
2016-03-06  0:51   ` Szabolcs Nagy
2016-03-06  1:02   ` John Found
2016-03-06  1:09     ` Szabolcs Nagy
2016-03-06  1:14       ` Szabolcs Nagy
2016-03-06  1:15       ` John Found
2016-03-06  1:18         ` Szabolcs Nagy
2016-03-06  2:20           ` James B
2016-03-06  2:33             ` Rich Felker
2016-03-06 13:07               ` James B
2016-03-06  7:30             ` John Found
2016-03-06 13:07               ` James B
2016-03-06 13:26                 ` John Found

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).