Skip to content

fix build on Ubuntu #2001

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

Closed
wants to merge 1 commit into from
Closed

fix build on Ubuntu #2001

wants to merge 1 commit into from

Conversation

shawnl
Copy link
Contributor

@shawnl shawnl commented Feb 23, 2019

Not sure why this is now broken, but it isn't a big deal to take this test out.

@andrewrk
Copy link
Member

andrewrk commented Feb 23, 2019

Can you explain why this doesn't work in Ubuntu? That static assert is protecting the kfreebsd target. What is the compile error you are getting? Also what version of ubuntu?

@andrewrk andrewrk added the work in progress This pull request is not ready for review yet. label Feb 23, 2019
It appears that Ubuntu (and IIRC Debian) removed KFreeBSD from llvm

[1/3] Building CXX object CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o
FAILED: CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o
/usr/bin/c++   -I../deps/lld/include -I/usr/lib/llvm-7/include -I../deps/SoftFloat-3e/source/include -I../ -I. -I../src -g   -std=c++11 -Werror -Wall -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti  -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces -MD -MT CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o -MF CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o.d -o CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o -c ../src/zig_llvm.cpp
../src/zig_llvm.cpp:1032:59: error: ‘KFreeBSD’ is not a member of ‘llvm::Triple’
 static_assert((Triple::OSType)ZigLLVM_KFreeBSD == Triple::KFreeBSD, "");
                                                           ^~~~~~~~
ninja: build stopped: subcommand failed.
@shawnl
Copy link
Contributor Author

shawnl commented Feb 24, 2019

[1/3] Building CXX object CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o FAILED: CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o /usr/bin/c++ -I../deps/lld/include -I/usr/lib/llvm-7/include -I../deps/SoftFloat-3e/source/include -I../ -I. -I../src -g -std=c++11 -Werror -Wall -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces -MD -MT CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o -MF CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o.d -o CMakeFiles/zig_cpp.dir/src/zig_llvm.cpp.o -c ../src/zig_llvm.cpp ../src/zig_llvm.cpp:1032:59: error: ‘KFreeBSD’ is not a member of ‘llvm::Triple’ static_assert((Triple::OSType)ZigLLVM_KFreeBSD == Triple::KFreeBSD, ""); ^~~~~~~~ ninja: build stopped: subcommand failed.

It appears that Ubuntu removed KFreeBSD from llvm

@shawnl
Copy link
Contributor Author

shawnl commented Feb 24, 2019

This is Ubuntu 19.04, but I also experienced this on Ubuntu 18.10

@andrewrk
Copy link
Member

andrewrk commented Feb 24, 2019

Here's the way I see this:

Ubuntu has mangled their LLVM package and it is no longer suitable to build Zig. At first my response is to say, sorry, Ubuntu LLVM packages are not supported, because they have patched out an OS that Zig supports.

However I looked up more details about kFreeBSD and it appears to be discontinued due to not being popular enough. So, I think an acceptable course of action is to remove kFreeBSD from the list of Zig supported OS targets. This would mean we can drop the static assert and Ubuntu's LLVM package will satisfy Zig's requirements.

So to solve this, this pull request needs to fully remove kFreeBSD as one of Zig's supported targets. That work will be in target.cpp and target.hpp, and then it will have to be removed from @import("builtin") which will probably then cause some compile errors needing to be fixed in userland.

I would also like to file a bug report with Debian and/or Ubuntu in their LLVM package for doing this.

And finally, as a workaround, one can build LLVM from source, or use http://apt.llvm.org/. And as always, the static builds on ziglang.org/download will continue to work for Ubuntu users.

@andrewrk
Copy link
Member

andrewrk commented Mar 2, 2019

I'd like to push back on Ubuntu with this. Why did they remove the kfreebsd target?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress This pull request is not ready for review yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants