can i used arduino library on atmega8?

Maybe.
This post seems to suggest that if you have an Atmega8 then it is possible.

Ray