public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/104895] New: lto1: issue with space in library filename
@ 2022-03-12 15:09 christophm30 at gmail dot com
  2022-03-12 17:55 ` [Bug lto/104895] " christophm30 at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: christophm30 at gmail dot com @ 2022-03-12 15:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104895

            Bug ID: 104895
           Summary: lto1: issue with space in library filename
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christophm30 at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

When building Souffle, I ran into an LTO issue with a library that contains a
space in its filename (see
https://github.com/souffle-lang/souffle/issues/2214).

I've isolated the issue as follows (Fedora 35: gcc (GCC) 11.2.1 20220127 (Red
Hat 11.2.1-9)):

Makefile:
CC=gcc
CFLAGS=-fPIC
CFLAGS:=$(CFLAGS) -flto=auto
RM=rm -f
all: ltomain

"lib do it".so: doit.o
        $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,"lib'do it'.so" -o
"lib'do it'.so" doit.o

ltomain: main.o "lib do it".so
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ main.o -L. -l"'do it'"
clean:
        $(RM) *.o *.so ltomain

doit.c:
#include <stdio.h>
void doit(void)
{
  printf("Hello world!\n");
}
void doit();

main.c:
int main()
{
  doit();
}

This gives the following error:
$ make clean all
rm -f *.o *.so ltomain
gcc -fPIC -flto=auto   -c -o main.o main.c
gcc -fPIC -flto=auto   -c -o doit.o doit.c
gcc -fPIC -flto=auto  -shared -Wl,-soname,"lib'do it'.so" -o "lib'do it'.so"
doit.o
lto1: error: open it.so. failed: No such file or directory
make[1]: *** [/tmp/ccetIqO9.mk:2: /tmp/ccIqDtkB.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: "lib] Error 1

Replacing '-flto=auto' by '-flto' works:
$ make clean all
rm -f *.o *.so ltomain
gcc -fPIC -flto   -c -o main.o main.c
gcc -fPIC -flto   -c -o doit.o doit.c
gcc -fPIC -flto  -shared -Wl,-soname,"lib'do it'.so" -o "lib'do it'.so" doit.o
gcc -fPIC -flto  -shared -Wl,-soname,"lib'do it'.so" -o "lib'do it'.so" doit.o
gcc -fPIC -flto  -shared -Wl,-soname,"lib'do it'.so" -o "lib'do it'.so" doit.o
gcc -fPIC -flto  -o ltomain main.o -L. -l"'do it'"

$ LD_LIBRARY_PATH=. ./ltomain
Hello world!

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

end of thread, other threads:[~2022-03-14  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-12 15:09 [Bug lto/104895] New: lto1: issue with space in library filename christophm30 at gmail dot com
2022-03-12 17:55 ` [Bug lto/104895] " christophm30 at gmail dot com
2022-03-12 20:51 ` christophm30 at gmail dot com
2022-03-13  7:43 ` pinskia at gcc dot gnu.org
2022-03-14  8:39 ` rguenth at gcc dot gnu.org

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 read-only IMAP folder(s) and NNTP newsgroup(s).