I'm working on Ubuntu and I've made a static c library following the instructions on this site.
But the resulting .a package works only on the machine where it has been compiled.
I know that an .a archive contains object files (only one in my case), so, can I package together object files compiled in different machines (i386 and amd64) in a way so GCC can know which file should be using?
If I cannot, can at least make my library recognizable by other same-arch machines?
(using -L. -llibraryname
)
Example:
archive name "libvisualt64.a"
command: gcc -o main main.c -L. -lvisualt64
Says:
skipping incompatible ./libvisualt.a when searching for -lvisualt64 cannot find -lvisualt64 error: ld returned 1 exit status
In this case I compiled the source and built the archive in the same 64bit machine just yesterday. And yesterday it worked fine. This happens on 32bit machines too.