The log says:
:info:build gresource-tool.c:34:20: error: libelf.h: No such file or directory
This sounds like #33948 which I thought I had worked around. However before we get carried away analyzing this, the log also says:
:debug:main Skipping completed org.macports.archivefetch (glib2)
:debug:main Skipping completed org.macports.fetch (glib2)
:debug:main Skipping completed org.macports.checksum (glib2)
:debug:main Skipping completed org.macports.extract (glib2)
:debug:main Skipping completed org.macports.patch (glib2)
:debug:main Skipping completed org.macports.configure (glib2)
This means this was not a clean build attempt so we should not trust it. Please run:
sudo port clean glib2
Then try again. If it fails again, then attach the new main.log.