I will encounter this error in x64 when linking static libraries, not in x86
What is the problem?
Is this a publicly available static library? If yes, which one? Was it compiled with MSVC, GCC, or Clang?
I've located the unit
But I can't find any problems
The problem is likely the static library (or more precisely FPC's internal linker not handling that library correctly), not your unit.
Adding - Xe and x64 to the command line of FPC compiler also succeeded
What macros can be used in unit files? - Xe?
-Xe is a program level option and can't be used inside a unit.