Rollo62 558 Posted July 30, 2019 (edited) I'm still testing porting from 10.3.1 to 10.3.2 In one FMX project for Macos, when just opening and compiling the working project, I've got some messages when compiling under Macos64 Quote [dccosx64 Error] E2597 ld: warning: directory not found for option '-LC:\Users\reg_w\OneDrive\Dokumente\Embarcadero\Studio\20.0\Imports' ld: file not found: kernel32.dll [dccosx64 Fatal Error] F2588 Linker error code: 1 ($00000001) Failed (Of coarse it works well under all other platforms). 1.) This message is strange, because the Imports folder is not there at all, not even the 20.0\ folder, because I installed the IDE under d:\Prj\... Under d:\Prj\Embarcadero\Studio\20.0\Imports I have that folder (which is almost empty, just a subfolder with one VCL related file "\Idl\StdVCL.idl". 2.) Its strange because of the reference to kernel32.-dll I have searched my settings, compiler, linker, deployment, registry, but I'm not lucky and couldn't find where these locations are maybe set. My BDSCOMMONDIR environment variable points to a folder close: C:\Users\reg_w\OneDrive\Dokumente\Embarcadero\Studio\20.0, but thats working at all other platforms. Then I decided to completely migrate via an new, empty project, like I described here: Create new FMX app, removed orignal unit1 and added my units from the old project. So now I got a more informative message, but still similar: compiling OK, linking failed Quote [dccosx64 Error] E2597 ld: warning: directory not found for option '-L\API' ld: warning: directory not found for option '-L\ComponentHelpers' ld: warning: directory not found for option '-L\Controls' ld: warning: directory not found for option '-L\Core' ld: warning: directory not found for option '-L\Features\Firebase' ld: warning: directory not found for option '-L\Features\NFC' ld: warning: directory not found for option '-L\Src\Features\Notifications' ld: warning: directory not found for option '-L\Include' ld: warning: directory not found for option '-LC:\Users\reg_w\OneDrive\Dokumente\Embarcadero\Studio\20.0\Imports' ld: file not found: kernel32.dll [dccosx64 Fatal Error] F2588 Linker error code: 1 ($00000001) Failed The empty project runs, but when I add my units, something went wrong. I'm not recalling to have anything affecting linking in my code, but I haven't checked that yet. Which screw could I turn to remove this linker error, I hope somebody has a clue ? Edit: As usual, just when I prepare and sended a thread, it hits me in the face what this could be. The folder seems to be related to Spring4D .. To get Spring4D compiled, I used the following addition to switch to PUREPASCAL, which seemed to compile fine. I'M using the development branch, from not too long ago (2 weeks), haven't checked for changes. {$I Spring.inc} {$IFDEF MACOS64} // <--Addition {$DEFINE PUREPASCAL} {$ELSE} {.$DEFINE PUREPASCAL} {$ENDIF MACOS64} unit Spring.Events; So probably I have to c heck what happens with Spring4D in my Macos64 tests ... How can I switch S4D to Macos64 in the right way ? Edited July 30, 2019 by Rollo62 Share this post Link to post
Dave Nottage 585 Posted July 30, 2019 2 hours ago, Rollo62 said: ld: warning: directory not found for option '-L\ComponentHelpers' ld: warning: directory not found for option '-L\Controls' ld: warning: directory not found for option '-L\Core' ld: warning: directory not found for option '-L\Features\Firebase' ld: warning: directory not found for option '-L\Features\NFC' ld: warning: directory not found for option '-L\Src\Features\Notifications' Those paths look suspiciously like mine in Kastri Free. What exactly are you compiling? 2 hours ago, Rollo62 said: ld: file not found: kernel32.dll I suggest checking whether you have a unit that references the DLL without having a conditional define, or that the path to it is included for macOS when it should not be Share this post Link to post
Fritzew 51 Posted July 30, 2019 3 hours ago, Rollo62 said: So probably I have to c heck what happens with Spring4D in my Macos64 tests ... How can I switch S4D to Macos64 in the right way ? There is a commit from yesterday on Bitbucket, so I think you should update...... Share this post Link to post
Rollo62 558 Posted July 30, 2019 (edited) @Dave Nottage Well thanks, perfect tip again. I was alrerady diving deep in other tasked, but I just doublechecked this. There was a well hidden reference in OSX-specific code (typical copy-paste problem ) This reference was nicely separated in its own OSX unit uses {$IF Defined(IOS)} Sys.Power.WakeLock.Impl.iOS {$ELSEIF Defined(ANDROID)} Sys.Power.WakeLock.Impl.Android {$ELSEIF Defined(MSWINDOWS)} Sys.Power.WakeLock.Impl.Win {$ELSEIF Defined(MACOS)} Sys.Power.WakeLock.Impl.OSX {$ELSE} {$MESSAGE Error 'IWakeLock not supported on this platform'} {$ENDIF} ; but unfortunately the hidden reference resides in a region unit Sys.Power.WakeLock.Impl.OSX; .... {$REGION 'Windows helper functions'} function SetThreadExecutionState(esFlags: EXECUTION_STATE): EXECUTION_STATE; stdcall; external 'kernel32.dll'; {$ENDREGION} So this was hardly visible, if region was not expanded. Anyway, it was just this line, never used in the unit at all. Thats a good reason why I tend to avoid regions usually, and here I had one of the few places where I still used it by accident. I wonder why this never got any message/warning/hint/ under Macos32 ? Maybe Macos can make use of Windows kernel32.dll somehow Thanks for pointing me in the right direction. App is running now normally under Macos64 ( w/o any changes), even with the dirty Spring4D fix, and more important for me with Bluetooth LE support running at same code under Macos32/64 Bit (which was my biggest worry for me). Looks very good, need more time to test, but so far all is running out of the box. At compiletime I still get a warning: Quote [dccosx64 Hint] H2596 ld: warning: directory not found for option '-LC:\Users\reg_w\OneDrive\Dokumente\Embarcadero\Studio\20.0\Imports' So maybe one day I find where this reference is, but for now I will check and test the more important parts. @Fritzew Thanks for the info, then I will be able re-test all my Spring4D related code soon. Since I already postponed this to the latest possible moment, and just started with the first project. Edited July 30, 2019 by Rollo62 1 Share this post Link to post
GabrielMoraru 27 Posted Tuesday at 07:43 PM Quote I get the same warning: [dccosxarm64 Error] E2597 ld: warning: directory not found for option '-LC:\Users\trei\Documents\Embarcadero\Studio\22.0\Imports\OSXARM64' ld: can't open output file for writing: .\FmxMsgBox, errno=13 for architecture arm64 [dccosxarm64 Fatal Error] F2588 Linker error code: 1 ($00000001) Failed So, I don't get what was the problem in the end. I don't use Spring4D. Share this post Link to post
Dave Nottage 585 Posted Tuesday at 07:50 PM Just now, GabrielMoraru said: I get the same warning: [dccosxarm64 Error] E2597 ld: warning: directory not found for option '-LC:\Users\trei\Documents\Embarcadero\Studio\22.0\Imports\OSXARM64' ld: can't open output file for writing: .\FmxMsgBox, errno=13 for architecture arm64 [dccosxarm64 Fatal Error] F2588 Linker error code: 1 ($00000001) The warning (i.e. not an error)... Just now, GabrielMoraru said: I don't use Spring4D. ..has nothing to do with Spring4D. Rollo's error (i.e. not the warning part) was related to Spring4D. Your error: ld: can't open output file for writing: .\FmxMsgBox, errno=13 for architecture arm64 ..is for something else. Whatever FmxMsgBox is a part of. Share this post Link to post
GabrielMoraru 27 Posted Tuesday at 07:54 PM Just now, Dave Nottage said: Whatever FmxMsgBox is a part of. FmxMsgBox.dpr is the current project. Really small. But it uses two packages (mine). Share this post Link to post
Dave Nottage 585 Posted Tuesday at 08:03 PM 2 minutes ago, GabrielMoraru said: FmxMsgBox.dpr is the current project. Really small. But it uses two packages (mine). errno=13 is permission denied, so either there's insufficient rights to where the file is being output to, the file is already in use, or some external factor (e.g. Antivirus) is preventing access. Share this post Link to post
GabrielMoraru 27 Posted Tuesday at 08:28 PM (edited) 2 hours ago, Dave Nottage said: errno=13 is permission denied, so either there's insufficient rights to where the file is being output to, the file is already in use, or some external factor (e.g. Antivirus) is preventing access. There is something hidden in that cryptic message 🙂 I tried with an empty FMX app (0 code) and it works. Edited Tuesday at 10:52 PM by GabrielMoraru Share this post Link to post
Rollo62 558 Posted Wednesday at 06:57 AM (edited) 11 hours ago, GabrielMoraru said: I don't use Spring4D. This topic has nothing to do with Macos, FMX, Spring4D, Kastri or whatsever. This error was caused by a region, which was a leftover from Copy-Paste code from Windows, which I shouldn't do in the first place. The Region {$REGION 'Windows helper functions'} function SetThreadExecutionState(esFlags: EXECUTION_STATE): EXECUTION_STATE; stdcall; external 'kernel32.dll'; was hiding this Windows-Kernel related kernel reference, which was never used anywhere, but this one line never showed up as an error at this point. This tells me, that using regions to hide code, may also hide code to spot obvious failures sometimes. Edited Wednesday at 07:00 AM by Rollo62 1 Share this post Link to post
GabrielMoraru 27 Posted Wednesday at 09:16 AM (edited) > but this one line never showed up as an error at this point. I think this is what I didn't understood. So, this hidden line of code had an error but the compiler did not show it in the "Messages" as an error? I guess this is actually a linker error.... Right? __________ Strange. I had a similar problem but in my case the error was TOTALLY different. It is true that the test I have done was on Android. Mysterious are compiler's ways. 🙂 Edited Wednesday at 09:21 AM by GabrielMoraru Share this post Link to post