Recent

Author Topic: Cannot find users used by... on OSX  (Read 231 times)

guiwunsch

  • Newbie
  • Posts: 3
Cannot find users used by... on OSX
« on: August 05, 2019, 06:50:24 pm »
Hi.
I'm trying to use users library on OSX, but when I compile some project with this library an error appears:

Code: Pascal  [Select]
  1. Unit1.pas(33,84) Fatal: Cannot find users used by Unit1.pas.

If I use CMD + Click in the library I can find its source code.
I'm using Lazarus 2.0.2a, FPC 3.0.4a and FPC SRC 3.0.4
How can I solve this?

Thanks.


trev

  • Full Member
  • ***
  • Posts: 214
  • Former Delphi 7 and Delphi 10.2 User
Re: Cannot find users used by... on OSX
« Reply #1 on: August 07, 2019, 01:59:49 am »
A small demo program with source code for your issue would help to see if, eg, I can duplicate the issue.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2269
    • havefunsoft.com
Re: Cannot find users used by... on OSX
« Reply #2 on: August 07, 2019, 02:11:51 am »
I'm using Lazarus 2.0.2a, FPC 3.0.4a and FPC SRC 3.0.4
How can I solve this?
"users" is an FPC package.
Typically if a package can be built manually.
But in case of "users" an attempt to build produce the following message:
Code: [Select]
Skipped package users which has been disabled for target x86_64-darwin
That makes me think, that it has been disabled for a some reason. Probably because the unit is designed to work for Linux only.
(Even though macOS is sort of BSD family system, it's likely has its own layer of user authentication)

P.S: (how it should work)
in order to build an FPC package, you need to enter the package directory (through Terminal). (The same place where "users.pp" file is located, but one directory up) and run
"make"

Installing a package (to the default directory) is typically achieved by running:
"sudo make install"
at the same directory. The default destination directory is typically /usr/local... which requires sudo access.

P.P.S: (how to make it work, bypassing the limitation)
you can forcefully compile the unit. Simply COPY users.pp, grp.pp and pwd.pp  from FPC package sources folder to your project folder. The compiler would attempt to use the source.

... and if all functions from users would work as expected, you might want to bug report the problem and request the package to be compiled for macOS as well.

P.P.P.S. (what's going on)
Let me explain some confusion about: "why I can see the source code, but the compiler doesn't find the unit".
Lazarus wants FPC package sources to be present (because they're needed for Codetools).
FPC compiler itself DOES NOT want FPC package sources anywhere, as it comes with PRECOMPILED packages and is configured to use PRECOMPILED.

So, whenever you use "users" unit in your application. Even if you can see sources, those sources are not used. Instead PRECOMPILED unit is used or attempted to be used.

On macOS there's no PRECOMPILED unit, that's why you're getting this weird situation. - you can see sources but not unit is found.

And copying "users.pp" to your project is actually forcing the compiler to use the sources and compile them.
« Last Edit: August 07, 2019, 02:27:30 am by skalogryz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz