mailing list of musl libc
 help / color / mirror / code / Atom feed
* Trouble compiling with Postgres library
@ 2014-11-25 20:13 John Mudd
  2014-11-25 20:18 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: John Mudd @ 2014-11-25 20:13 UTC (permalink / raw)
  To: musl; +Cc: John Mudd

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

Please cc me on replies. My work network is now blocking access to
http://www.openwall.com/lists/musl/ because "it's located in Russian
Federation".

First I built Postgres with musl. That works well and I've been
distributing musl Postgres in production.

Today I'm trying to build a program that will be linked with Postgres libs.
For some reason though it's invoking "ld" and getting confused with the
standard C lib. Any suggestions?

$ musl-gcc -o hello hello.c
$ hello
Hello!
$ musl-gcc -o test1 test1.o -L/usr/rx30/musl/postgresql-9.3.4.install/lib
-lecpg
/usr/bin/ld: h_errno: TLS definition in //lib/i386-linux-gnu/libc.so.6
section .tbss mismatches non-TLS definition in
/home/mudd/musl/musl-1.1.0.install/lib/libc.so section .bss
//lib/i386-linux-gnu/libc.so.6: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
$
$ which musl-gcc
/usr/rx30/musl/musl-1.1.0.install/bin/musl-gcc
$ cat /usr/rx30/musl/musl-1.1.0.install/bin/musl-gcc
#!/bin/sh
exec "${REALGCC:-gcc}" "$@" -specs
"/home/mudd/musl/musl-1.1.0.install/lib/musl-gcc.specs"
$ cat /home/mudd/musl/musl-1.1.0.install/lib/musl-gcc.specs
%rename cpp_options old_cpp_options

*cpp_options:
-nostdinc -isystem /home/mudd/musl/musl-1.1.0.install/include -isystem
include%s %(old_cpp_options)

*cc1:
%(cc1_cpu) -nostdinc -isystem /home/mudd/musl/musl-1.1.0.install/include
-isystem include%s

*link_libgcc:
-L/home/mudd/musl/musl-1.1.0.install/lib -L .%s

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

*startfile:
%{!shared: /home/mudd/musl/musl-1.1.0.install/lib/%{pie:S}crt1.o}
/home/mudd/musl/musl-1.1.0.install/lib/crti.o
%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}

*endfile:
%{shared|pie:crtendS.o%s;:crtend.o%s}
/home/mudd/musl/musl-1.1.0.install/lib/crtn.o

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

*esp_link:


*esp_options:


*esp_cpp_options:


$

John

[-- Attachment #2: Type: text/html, Size: 2749 bytes --]

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

* Re: Trouble compiling with Postgres library
  2014-11-25 20:13 Trouble compiling with Postgres library John Mudd
@ 2014-11-25 20:18 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2014-11-25 20:18 UTC (permalink / raw)
  To: John Mudd; +Cc: musl

On Tue, Nov 25, 2014 at 03:13:04PM -0500, John Mudd wrote:
> Please cc me on replies. My work network is now blocking access to
> http://www.openwall.com/lists/musl/ because "it's located in Russian
> Federation".
> 
> First I built Postgres with musl. That works well and I've been
> distributing musl Postgres in production.
> 
> Today I'm trying to build a program that will be linked with Postgres libs.
> For some reason though it's invoking "ld" and getting confused with the
> standard C lib. Any suggestions?
> 
> $ musl-gcc -o hello hello.c
> $ hello
> Hello!
> $ musl-gcc -o test1 test1.o -L/usr/rx30/musl/postgresql-9.3.4.install/lib
> -lecpg
> /usr/bin/ld: h_errno: TLS definition in //lib/i386-linux-gnu/libc.so.6
> section .tbss mismatches non-TLS definition in
> /home/mudd/musl/musl-1.1.0.install/lib/libc.so section .bss
> //lib/i386-linux-gnu/libc.so.6: error adding symbols: Bad value
> collect2: error: ld returned 1 exit status

This definitely means it's trying to link glibc. Adding -v to the
gcc command line would show the full command line that's being passed
to collect2/ld, which might give a hint as to why this is happening.
It's also possible that your postgresql libs have an rpath entry
pointing to /lib/i386-linux-gnu that the linker is following. I would
inspect libecpg.so and all of its dependencies with readelf to see if
they contain anything suspicious.

Rich


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

end of thread, other threads:[~2014-11-25 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-25 20:13 Trouble compiling with Postgres library John Mudd
2014-11-25 20:18 ` Rich Felker

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).