Defining Gopakumar-Vafa's BPS invariants for Calabi-Yau threefolds