For:

    (defun my-w3m-view-url ()
      (interactive)
      (browse-url (w3m-anchor)))
    (eval-after-load 'w3m
      (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url))

when byte-compiled I get error on key binding `RET` usage:

    my-w3m-view-url: Invalid function: w3m-anchor

This because `w3m-anchor` isn't a function but become macro. I try to add:

    (eval-when-compile
      (require 'w3m-util nil :no-error))

But this doesn't help me.