On both versions, the build fails during the configure step with configure: error: C compiler cannot create executables config.log contains the following info about the offending check: configure:3483: checking whether the C compiler works configure:3505: x86_64-gentoo-linux-musl-gcc -march=native -O2 -pipe -fno-strict-aliasing -Wl,-O1 -Wl,--as-needed conftest.c -liconv >&5 /usr/lib/gcc/x86_64-gentoo-linux-musl/4.9.4/../../../../x86_64-gentoo-linux-musl/bin/ld: cannot find -liconv collect2: error: ld returned 1 exit status configure:3509: $? = 1 configure:3547: result: no Can post output of emerge --info '=x11-libs/motif-2.3.5::gentoo' if necessary.
Try replacing if use !elibc_glibc && use !elibc_uclibc && use unicode; then by if use !elibc_glibc && use !elibc_uclibc && use !elibc_musl && use unicode; then in the ebuild.
Both packages compile successfully after this change and seem to work without any problems.
Fixed in motif-2.3.6-r1. Thanks for reporting.