Tried to do a search, but didn't find anything. Whenever I try to compile a shared object and the test binary that links to it I get this error:
[root@hypervisor test-files]# ./test
./test: symbol lookup error: ./test-files.so: undefined symbol: stat
[root@hypervisor test-files]#
After playing around with it I found that if I feed -O
to gcc during the compile, stat() starts working as expected. I haven't been able to find any indication online as to why -O of all things fixes a problem with an undefined symbol (or does it just mask an error instead of fixing it?).