Lazarus

Programming => Packages and Libraries => Topic started by: guiwunsch on August 05, 2019, 06:50:24 pm

Title: Cannot find users used by... on OSX
Post by: guiwunsch 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.

Title: Re: Cannot find users used by... on OSX
Post by: trev 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.
Title: Re: Cannot find users used by... on OSX
Post by: skalogryz 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.
TinyPortal © 2005-2018