[SOLVED] how to get {$LINKLIB libgte.a} in to the linker script? lazarus / 64-FPC development ---------------------------------------------------------------------- Key-Real · 2024-07-19 12:06 I have some libraries like libgte.a my executable should be linked against. so i do in my program {$LINKLIB libgte.a} I'm at the writing linker script stage. how to get the name of this lib in my t_ps1.pas in class(TExternalLinker)? ---------------------------------------------------------------------- ccrause · 2024-07-19 15:43 One option (untested) is to add the static library name with AddStaticLibrary('libname.a'); early in the WriteResponseFile method in your t_ps1.pas file. ---------------------------------------------------------------------- Key-Real · 2024-07-19 15:46 If I tell {$L mylib.a} it cames to the linker as ObjectFiles.GetFirst I can live with it so how to get: -Fl/usr/lib32/ to the linker? ---------------------------------------------------------------------- MarkMLl · 2024-07-19 16:07 I don't know whether this is in any way helpful, but a few months ago I came across this https://forum.lazarus.freepascal.org/index.php/topi c,66610.msg510910.html#msg510910 very old thread which says QuoteIn a nutshell: {$LinkLib LIBNAME} --> you need the LIBNAME.a file {$Link LIBNAME} --> you need the LIBNAME.o file I decided that was useful enough as a guideline to add as a comment to some of my existing code in a couple of places. If it is wildly wide of the mark my apologies for adding noise to your thread (I did a bit of work on the MIPS target very early on when it had degenerated into two separate projects, it's improved a lot since then byt I've never had appropriate hardware on which to run it). MarkMLl ---------------------------------------------------------------------- TRon · 2024-07-19 16:25 @key-real: what toolchain are you using ? I am assuming gnu target mipsel-none-elf together with its binutils. (external) linker support is present in the compiler what I do not know if the existing mipsel target (already) added support for that (I assume it does/did). In case the latter then you can follow its lead. ---------------------------------------------------------------------- nickysn · 2024-07-19 16:26 Quote from: Key-Real on July 19, 2024, 05:46:13 pmIf I tell {$L mylib.a} it cames to the linker as ObjectFiles.GetFirst Well, looking at the TLinker object, there's also SharedLibFiles and StaticLibFiles. They are declared right after ObjectFiles. Don't one of these contain what you need? ---------------------------------------------------------------------- MarkMLl · 2024-07-19 16:57 Quote from: TRon on July 19, 2024, 06:25:11 pm(external) linker support is present in the compiler what I do not know if the existing mipsel target (already) added support for that (I assume it does/did). In case the latter then you can follow its lead. Once MIPS was floated into the mainstream- somewhere around 2.7.1- I definitely had both mipsel and mipseb running on emulated target boards using (I think) Qemu (we had a couple of SGI machines, but I can't remember whether I ever got a recognisable OS running on one of them). There was no toolchain weirdness that I recall, the bottom of https://wiki.freepascal.org/Native_MIPS_Systems shows that I was able to build a runnable compiler, but apparently some code generation tests were still failing so a full self-build did not work (I might have seen that fixed later). MarkMLl ---------------------------------------------------------------------- Key-Real · 2024-07-19 17:02 ok I pass Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ./compiler/ppcrossmipsel test.pas -O- -Fu./rtl/ps1 -Fu./rtl/inc -Fu./rtl/objpas -Tps1 -Cfnone -Fu./psy-q-sdk/bindings -Fl./psy-q- sdk/lib -a -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- I got the -Fl string by Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i HPath:= TCmdStrListItem(LibrarySearchPath.First); everything links, but the compiler tells me: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ree Pascal Compiler version 3.3.1 [2024/07/19] for mipselCopyright (c) 1993-2024 by Florian Klaempfl and othersTarget OS: PlayStation 1 for MIPSELCompiling test.pasAssembling programWarning: Object libgte.a not found, Linking may fail !Warning: Object libapi.a not found, Linking may fail !  ideas? ---------------------------------------------------------------------- nickysn · 2024-07-19 17:09 Yes. Find the warning in errore.msg, look at its identifier (hint: it's "exec_w_libfile_not_found"), then search the compiler sources for this identifier, to see all places where this message is generated. ---------------------------------------------------------------------- nickysn · 2024-07-19 17:11 Sorry, it's actually "exec_w_objfile_not_found", not "exec_w_libfile_not_found". ---------------------------------------------------------------------- Key-Real · 2024-07-19 17:15 btw: how to catch the -a compiler option? ---------------------------------------------------------------------- Key-Real · 2024-07-19 20:27 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   found:=FindFile(s,exepath,false,foundfile); if not(cs_link_nolink in current_settings.globalswitches) and (not found) then         Message1(exec_w_objfile_not_found,s);  he search in the exe path but I specify -Fl./path/ now what? ---------------------------------------------------------------------- ccrause · 2024-07-19 21:16 Quote from: Key-Real on July 19, 2024, 02:06:31 pmI have some libraries like libgte.a my executable should be linked against. so i do in my program {$LINKLIB libgte.a} I'm at the writing linker script stage. how to get the name of this lib in my t_ps1.pas in class(TExternalLinker)? After reading the other messages in this discussion I believe I misunderstood your original question. Your t_ps1.pas implementation of TLinkerPS1.WriteScriptFile seems incomplete when compared against the equivalent method WriteResponseFile of t_linux.pas or t_embed.pas.  You probably need to write ObjectFiles to the INPUT section, and StaticLibFiles to the GROUP section of the linker response file.