I’m compiling a game using the Source Engine. When I run make, after a while the archiver tool complains about an invalid option ".":
/usr/bin/ar: invalid option -- '.'
this happens with every archiver I have installed:
The command the makefile is trying to run is:
gcc-ar-10 ../lib/public/linux32/raytrace.a ./obj_raytrace_linux32/release/raytrace.o ./obj_raytrace_linux32/release/trace2.o ./obj_raytrace_linux32/release/trace3.o
I don’t use the archiver tool often, but this looks like a valid command to me.
Normally the issue with those is that a dash is being prepended which makes the archiver tool think whatever is following it are the "mini options" like
In my case there aren’t any dashes at all. I think the
. is from the path but that should be interpreted as a file path and not a command-line argument.
The first argument to
ar is supposed to be one or more characters indicating the operation to perform (optionally prefixed with
-) and modifiers to this operation.
If you want to create a new archive from the object files, you probably want
rcs, which asks
ar to insert the listed files into the archive with replacement (
r), create the archive if necessary (
c) and to create an index for the archive (
So for example:
gcc-ar-10 rcs ../lib/public/linux32/raytrace.a ./obj_raytrace_linux32/release/raytrace.o ./obj_raytrace_linux32/release/trace2.o ./obj_raytrace_linux32/release/trace3.o
I assume that
ar is giving you the error since it tries to interpret the first
. of the first argument as one of these operation instructions.