MoarVM / MoarVM

A VM with adaptive optimization and JIT compilation, built for Rakudo
https://moarvm.org/
Other
705 stars 172 forks source link

Fix building with system libtommath #997

Open mikhailnov opened 5 years ago

mikhailnov commented 5 years ago

Building with --has-libtommath failes. This patch fixes it:

--- a/src/6model/reprs/P6bigint.h
+++ b/src/6model/reprs/P6bigint.h
@@ -1,4 +1,4 @@
-#include "tommath.h"
+#include <tommath/tommath.h>

 #define MVM_BIGINT_32_FLAG      0xFFFFFFFF
 #define MVM_BIGINT_IS_BIG(body) ((body)->u.smallint.flag != 0xFFFFFFFF)

However, this patch will break building with bundled libtommath.

niner commented 5 years ago

This would apparently break the build on other systems:

nine@sphinx:~> rpm -ql libtommath-devel
/usr/include/tommath.h
/usr/include/tommath_class.h
/usr/include/tommath_superclass.h
/usr/lib64/libtommath.so
mikhailnov commented 5 years ago

Hm, you are right,INCPATH=%{_includedir}/tommath is used in ROSA Linux (https://abf.io/perl6/libtommath/blob/rosa2016.1/libtommath.spec#lc-66).

I don't how how you handle switching between system and bundled libraries, for example, in Audacity, #include "header.h" are in the code, but there is a file header.h, to which the build system writes either #include <header.h> to use the system library or #include "src/path/to/bundled/library/header.h" to use the bundled library.

mikhailnov commented 5 years ago

Also see my patch for libtommath:

I had to make it to build MoarVM with system libtommath in ROSA.

sjaeckel commented 5 years ago

Can someone who knows how the MoarVM build system works internally have a look into this issue please?

cygx commented 5 years ago

I suspect the place to fiddle with is https://github.com/MoarVM/MoarVM/blob/master/Configure.pl#L260

Compared to other external libs, it's missing a call to setup_native_library()...

jstuder-gh commented 5 years ago

I've submitted a PR that uses setup_native_library as subjected by @cygx above, but unfortunately it looks like it won't fix the building issue as it appears ROSA doesn't bundle a .pc in its libtommath-devel package.

However, libtommath does now include a template .pc file in the source, so if ROSA begins including a customized version in their packages it should build without issue in the future.

mikhailnov commented 5 years ago

ROSA's newest libtommath-devel package does have a .pc file: https://abf.io/build_lists/2953316