Problem with gcc flag/file order when compiling against ROOT libraries

Search for “--as-needed” in man ld -> Command Line Options