While artillery may work, it doesn't take into account that said mobile structure will likely have screening forces making sure that it isn't destroyed that easily. And if you brought artillery, you were likely going to deal with significant forces anyways, so the presence of a mobile structure just means you have a more mobile target.
Taking it out via combat engineering (Building trenches in front of it) likely won't work very well. Humankind developed tactics for going over trenches a very long time ago; In fact, over 100 years ago. It consisted of... Big metal boxes with tracks. What makes someone think that a big trench will stop an EVEN BIGGER metal box? Even then, that big of a trench would be a complete waste of man-hours. And if it's big enough to have something that's wider than 60 meters fall into it and get stuck, the crew will likely notice and avoid it. That's also assuming that the screening force didn't notice it minutes or hours in advance. Mines and whatnot are fair game, but those have the similar problem of assuming the enemy Commander is completely incompetent.
I understand that the factions of Battletech grab the idiot ball a lot, but even they aren't stupid enough to get a 90-meter-wide machine stuck in a 30-meter-across hole, or drive a gigantic, super-noticable landcrawler into the middle of a freaking warzone. Especially considering these platforms are typically not mobile enough and more than expensive enough to only be deployed on bases as a defensive measure, whether at a major FoB or at the central base on a world; Acting as self-contained mobile artillery pieces, subcapital defenses, or more standard roles. You will almost never be facing just one, or one without other units acting in defense, in any role.
Long story short; If the enemy commander was so stupid as to bring the damn thing to the front lines without support unless the front lines are at the doorstep, they must be a flunky from Warhammer 40K. Because that sort of idiocy, despite factions making stupid decisions all the time, is only present with Author Fiat, or by making the world so stupidly grimdark that hundreds of thousands of tons of resources are getting wasted because 'LUL DRIVE THE LANDCRAWLER FORWARD, I WANNA WHACK EM WITH MY SWORD'.
As for my suggestion to kill one, Artillery Spam, if at all possible.