lcd won't work with library

That looks just like the DFRobot LCD shield (Arduino_LCD_KeyPad_Shield__SKU__DFR0009_-DFRobot).

In that case you you would need to use:

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

And the backlight would be controlled by digital pin 10. There's a complete sketch at that link as well. Do not even try the first one, the LCD4Bit library and it's derivatives are obsolete and poorly written (just read the comments if you don't believe me).

Don