I have a program that works correctly on my development machine, but causes an illegal command error when testing on a "clean machine" where only the necessary files were copied.
The program consists of my shared library built from C ++ sources and an example C wrapper program that demonstrates the use of libraries. On the development machine, they are all built in Eclipse w / g ++, and both Debug and Release work fine. A number of standard libraries are linked.
To check the dependencies that I might have missed, I copied the .c file, the .so file, and the .h library file for a new Linux installation and compiled / linked them to a simple script created with the same release compilation options that Eclipse uses. Both machines have g ++ 4.3.2.
When I run the program on a clean machine, it exited immediately after printing "Illegal Instruction".
Running in gdb calls:
(gdb) run Starting program: /home/sfallows/Source/Apps/MySample/MySample [Thread debugging using libthread_db enabled] [New Thread 0xb5c4ca90 (LWP 7063)] Program received signal SIGILL, Illegal instruction. [Switching to Thread 0xb5c4ca90 (LWP 7063)] 0xb7f0cb29 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /usr/include/c++/4.3/iostream:77 77 static ios_base::Init __ioinit; Current language: auto; currently c++ (gdb) bt
I'm not sure why static constructors are running in NodeLock.cpp. I have neither static / global objects in this file, nor any static / global objects of this class anywhere.
The development machine is the Intel Core2 Quad and the clean machine is the Pentium 4 Dual. I believe that g ++ uses a common subset of x86 instructions by default and that the difference in processor is not my problem.
Any suggestions on what else to look at for an estimate. I try to avoid installing all library sources and dependencies on a clean machine.
Reply to rmn and John Bocker's comment: In the Windows world, exes and dll run on a variety of Intel and AMD processors, so a common subset of instructions is obviously widely used. I thought gcc would do the same? I suppose I'll fully explore the command set / architecture options.