Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build with GCC13 on NetBSD failed due to Error: unsupported instruction `vpdpbusd' #387

Closed
leleliu008 opened this issue Aug 22, 2024 · 6 comments
Labels

Comments

@leleliu008
Copy link
Contributor

details please see https://github.com/leleliu008/test/actions/runs/10511472981/job/29122507907

@ebiggers
Copy link
Owner

The problem is that the gcc13 package in NetBSD (/usr/pkg/gcc13/bin/gcc) is configured to use the "system" assembler (/usr/bin/as) which is from binutils 2.34, instead of the "pkgsrc" assembler (/usr/pkg/bin/gas) which is from binutils 2.41.

When gcc is upgraded, the binutils it uses needs to be upgraded alongside it. Otherwise, not all instructions the compiler generates can be assembled.

I recommend that you report the misconfigured gcc13 to the maintainer of that package in NetBSD, and for now do the build with the NetBSD's "system" gcc (/usr/bin/gcc) which is gcc 10 and is properly paired with the binutils 2.34.

The only workaround that libdeflate could do is detect broken toolchains in the CMakeLists.txt and disable optimized code accordingly. Performance would decrease, and this workaround would not work for anyone using another build system. I would prefer that people fix their toolchains instead, as that is the real problem.

@ebiggers
Copy link
Owner

Here is the line that sets the assembler incorrectly when the gcc13 package is being built: https://github.com/NetBSD/pkgsrc/blob/trunk/lang/gcc13/Makefile.common#L90

@leleliu008
Copy link
Contributor Author

@ebiggers Thank you for your reply. I will try to use /usr/pkg/bin/gas

@leleliu008
Copy link
Contributor Author

This works for me:

sudo pkgin -y install gcc13 binutils cmake gmake

sudo ln -sf /usr/pkg/bin/gas /usr/bin/as

export  CC='/usr/pkg/gcc13/bin/gcc'
export CXX='/usr/pkg/gcc13/bin/g++'

cmake \
    -S . \
    -B build.d \
    -DCMAKE_VERBOSE_MAKEFILE=ON \
    -DCMAKE_COLOR_MAKEFILE=ON \
    -DCMAKE_INSTALL_PREFIX=$PWD/out \
    -DCMAKE_BUILD_TYPE=Release
cmake --build build.d
cmake --install build.d

@ebiggers
Copy link
Owner

Can you check if #389 allows libdeflate to build with gcc 13 on NetBSD without having to run sudo ln -sf /usr/pkg/bin/gas /usr/bin/as? The proper solution is still to get the gcc 13 NetBSD package fixed, but #389 should allow libdeflate to build regardless by disabling some optimized code that can't be assembled.

@leleliu008
Copy link
Contributor Author

@ebiggers It works. I test it with github actions: https://github.com/leleliu008/test/actions/runs/10642405602

@ebiggers ebiggers added the bug label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants