Page 1 of 1

Missing liblto_plugin_0.dll ?

Posted: Tue Jan 04, 2022 5:20 pm
by Lord
Hi!

I tried to compile a short program using this line in a batch file
gcc "purebasic.c" -o "gccShowVideo.exe" -O3
The result was a fatal error after some warnings
gcc: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found
compilation terminated.
This DLL is not found on my computer.
The program compiles and runs fine with asm and C back end in debug mode
and as an *.exe.
Where do I get this DLL and where to put it?

Re: Missing liblto_plugin_0.dll ?

Posted: Tue Jan 04, 2022 6:34 pm
by infratec
the name is listed inside of gcc.exe
But I have no idea which function requires this dll.
It's included in the mingw-base packet.

Re: Missing liblto_plugin_0.dll ?

Posted: Tue Jan 04, 2022 6:58 pm
by idle
I don't think you can compile from the purebasic.c file directly with gcc. The pbcompiler needs to extract the pb libries so they can get linked.

Re: Missing liblto_plugin_0.dll ?

Posted: Tue Jan 04, 2022 6:59 pm
by #NULL
I think it's required by the linker for some optimizations.

Re: Missing liblto_plugin_0.dll ?

Posted: Tue Jan 04, 2022 7:17 pm
by chi
You could try -fno-use-linker-plugin, but without the PB libraries you'll not be able to create an executable file.

Re: Missing liblto_plugin_0.dll ?

Posted: Wed Jan 05, 2022 3:00 am
by ChrisR
A workaround, not really nice... (I or you can delete this post if it is annoying)

Code: Select all

; -----------------------------------------------------------------------------
; polink.pb Beta!
; Get Compilation cmdlines via a fake polink.exe:
; -----------------------------------------------------------------------------
; Adapt the gcc switches to your needs and compile it in your folder in: polink.exe
; In PureBasic_6.00_x64\Compilers, save, rename polink.exe to polinkorg.exe then copy your Fake polink.exe in PureBasic_6.00_x64\Compilers 
; Then Create your executable, the Compilation cmdlines will be copied to the clipboard. To be used in cmd.exe before closing the Message Requester.
; Do not forget to restore polinkorg.exe to polink.exe when you no longer need it
; -----------------------------------------------------------------------------

Filename$ = ProgramFilename()
If FileSize(GetPathPart(Filename$) + "\" + GetFilePart(Filename$, #PB_FileSystem_NoExtension) + "org.exe") > 0
  CountParam = CountProgramParameters()
  For I=0 To CountParam-1
    PgmParam$ + ProgramParameter(I) + " "
  Next
  
  SetClipboardText("Cd /D " + GetCurrentDirectory() +#CRLF$+ 
                   "PATH=%PATH%;" + GetPathPart(Filename$) +#CRLF$+
                   "gcc.exe -O3 -Wno-incompatible-pointer-types -Wno-overflow -Wno-int-conversion -c -o PureBasic.obj purebasic.c" +#CRLF$+
                   GetFilePart(Filename$, #PB_FileSystem_NoExtension) + "org.exe " + PgmParam$ +#CRLF$+ "")
  
  MessageRequester("Compilation cmdlines", "Compilation cmdlines copied to the clipboard." +#CRLF$+#CRLF$+ "To be used in cmd.exe before closing this window")
EndIf

Re: Missing liblto_plugin_0.dll ?

Posted: Wed Jan 05, 2022 9:22 am
by Lord
Thanks for all your answers.

So it's just a c hype. Nothing for PureBasic users.
It seems, there is no benefit in speed or size.
At least in my projects there is no noticable improvement
from asm to c back end. And using gcc is a nogo.

Re: Missing liblto_plugin_0.dll ?

Posted: Wed Jan 05, 2022 1:04 pm
by AndyMK
I think the main point of the c compiler is to reach more platforms