-
Notifications
You must be signed in to change notification settings - Fork 347
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
Allow building GHDL mcode on FreeBSD #1020
base: master
Are you sure you want to change the base?
Conversation
Not available on FreeBSD 12 for example
On FreeBSD 12.1, this commit fixes: gnatlink ghdl_jit.ali -o ghdl_mcode -g memsegs_c.o chkstk.o jumps.o times.o grt-cbinding.o grt-cvpi.o grt-cdynload.o fstapi.o lz4.o fastlz.o -lm -Wl,--version-script=/home/asdf/repos/ghdl/build/../src/grt/grt.ver -Wl,--export-dynamic /usr/local/bin/ld: ghdl_mcode: local symbol `__progname' in /usr/lib/crt1.o is referenced by DSO /usr/local/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status gnatlink: error when calling /usr/local/gcc6-aux/bin/ada gnatmake: *** link failed. gmake: *** [Makefile:183: ghdl_mcode] Error 4
@endofexclusive, according to #501, you previously tried to use LLVM backend. Is this fix specific to mcode because LLVM is working already? Or you did not try LLVM recently? Furthermore, did you try to execute |
I have now investigated how GHDL built with LLVM and mcode backends work in more detail using the testsuite. Executive summary after exploring the testsuiteDetails are given below.
|
Thanks a lot! That's very helpful.
Actually, GHDL is not biased at all; there is no explicit priority regarding OS or architectures. I believe that @tgingold uses Debian on amd64, so that's where everything is first tested. Then, it is up to the users to test it on different platforms and help debug/fix issues locally. The same applies to the backends: Tristan normally works on mcode first, and LLVM/GCC bugs are found slightly later. However, it is true that FreeBSD is not explicitly listed as a supported platform in the README. I believe this is because we don't have a CI service for it, so we cannot guarantee/test that it works. It seems that running FreeBSD on Travis CI is quite complex (http://erouault.blogspot.com/2016/09/running-freebsd-in-travis-ci.html). I have not found any reference about running FreeBSD on GitHub Actions, but I expect it to be equally complex (unless nested virtualization is supported). Fortunately, Cirrus CI provides FreeBSD VMs (https://cirrus-ci.org/guide/FreeBSD/) and it's free (as in free beer) for open source projects (https://cirrus-ci.org/pricing/). We might consider adding Cirrus CI for FreeBSD only. However, I think we need to first investigate how to allow failures, to avoid every commit failing until support is fixed. @tgingold, wdyt? |
@@ -368,7 +368,7 @@ fi | |||
# Generate ortho_code-x86-flags | |||
if test $backend = mcode; then | |||
case "$build" in | |||
*darwin*) ortho_flags="Flags_Macosx${mcode64}" ;; | |||
*darwin* | *freebsd* ) ortho_flags="Flags_Macosx${mcode64}" ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to use Flags_Macosx instead of Flags_Linux ?
The difference is the stack alignment on x86. For darwin it is 16 bytes, for linux it is 8 bytes.
I thought that Freebsd is closer to linux.
@@ -56,7 +56,7 @@ else | |||
GRT_EXTRA_LIB=-ldl -lm $(GRT_ELF_OPTS) | |||
endif | |||
ifeq ($(filter-out netbsd freebsd% dragonfly%,$(osys)),) | |||
GRT_EXTRA_LIB=-lm $(GRT_ELF_OPTS) | |||
GRT_EXTRA_LIB=-lm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you get ride of GRT_ELF_OPTS, you might have issues with VPI.
I am ok with that change, but it must affect only freebsd.
@@ -28,7 +28,7 @@ | |||
set rights. | |||
*/ | |||
|
|||
#ifdef __APPLE__ | |||
#if defined(__APPLE__) || !defined(MREMAP_MAYMOVE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If freebsd supports mremap(2), better to use it.
Simply add #define MREMAP_MAYMOVE 0
How could the issues on freebsd be investigated ? Well, I suppose the simplest would be me to install it... |
How about http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/12.1-RELEASE/amd64/Latest/? |
These commits enables building of GHDL (mcode) on FreeBSD 12.1. Each of the three commits fixes one individual build failure. This pull request also fixes #501.
The exact configure and build commands for the successful build is:
System information: