X-compile MELT against ARC GNU

32 views
Skip to first unread message

Christophe Schmid

unread,
May 30, 2016, 5:26:46 AM5/30/16
to gcc-melt
Hello,

What follows here all is performed on an Ubuntu 14.04 LTS (3.13.0-83-generic).

I first tried to built MELT against my Ubuntu host OS gcc/g++ and it ran like a charm:

--> gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)

I try to cross-compile MELT source against ARC GNU toolchain 2016.03.
Sources and pre-built bin tarballs can be found here: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
I am using MELT version 1.1.3 since ARC GNU runs a GCC 4.8.5.

I followed instructions on this site: http://gcc-melt.org/download.html.
Especially section "Compiling and installing the GCC MELT plugin" especially the remark at point 4. saying:

If your GCC compiler is a cross-compiler, set your environment variable MELTGCC_NO_CHECK_RUNTIME with export MELTGCC_NO_CHECK_RUNTIME=yes to avoid having the melt-runtime.c be checked by an existing MELT pass. Most users have a straight compiler (not a cross-compiler) so should not have any MELTGCC_NO_CHECK_RUNTIME environment variable.
  1. export MELTGCC_NO_CHECK_RUNTIME=yes
  2. make all MELTCC=/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-gcc MELTCXX=/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/bin/arc-elf32-g+
So it builds, output goes as suggested into /tmp/meltinstall-1.1.3 from where I then install plugins into my local ARC GNU prebuilt installation path, in my case:

schmid@vmu13263:~/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin$ tree -L 1
.
├── gtype.state
├── include
├── melt-1.1.3.so
├── melt-headers
├── melt-module-1.1.3.mk
├── melt-modules
├── melt.so -> melt-1.1.3.so
└── melt-sources

I then try a simply example:

arc-elf32-gcc -fplugin=melt -fplugin-arg-melt-mode=runfile -fplugin-arg-melt-arg=helloworld.melt -fplugin-arg-melt-i-am=Basile -c empty.c

And I get this:

schmid@vmu13263:~/arc_gnu_gcc_plugin/melt_plugin$ arc-elf32-gcc -fplugin=melt -fplugin-arg-melt-mode=runfile -fplugin-arg-melt-arg=helloworld.melt -fplugin-arg-melt-i-am=Basile -c empty.c
cc1: error: cannot load plugin /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/bin/../lib/gcc/arc-elf32/4.8.5/plugin/melt.so
/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/bin/../lib/gcc/arc-elf32/4.8.5/plugin/melt.so: undefined symbol: __gmpz_get_str

I think it still tries to load first MELT built I did namely for my host Ubuntu gcc/g++ (not x-compiler!) that is installed as per MELT build instructions here:

schmid@vmu13263:/usr/lib/gcc/x86_64-linux-gnu/4.8/plugin$ tree -L 1
.
├── gengtype
├── gtype.state
├── include
├── melt-1.1.3.so
├── melt-headers
├── melt-module-1.1.3.mk
├── melt-modules
├── melt.so -> melt-1.1.3.so
└── melt-sources

4 directories, 5 files

Being lazy I then simply try this (specifiying explicitely where my MELT plugins .so is):

schmid@vmu13263:~/arc_gnu_gcc_plugin/melt_plugin$ arc-elf32-gcc -fplugin="/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/melt" -fplugin-arg-melt-mode=runfile -fplugin-arg-melt-arg=helloworld.melt -fplugin-arg-melt-i-am=Basile -c empty.c
cc1: error: cannot load plugin /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/melt
/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/melt: cannot open shared object file: No such file or directory

But seems I cannot do that.

I'll continue searching on how to make that work but you sure thing already know what I do wrong here.
Could you be so kind and help/tell me how to make work MELT with ARC GNU?

Thanks much & Br Christophe




Basile Starynkevitch

unread,
May 30, 2016, 6:36:09 AM5/30/16
to gcc-...@googlegroups.com, schmi...@gmail.com
AFAIK, that undefined symbol __gmpz_get_str is provided by some GMP library. So a possible work-around might be to link melt.so with a GMP library.

On my Debian/Sid/x86_64:
% nm -D /usr/lib/x86_64-linux-gnu/libgmp.so.10 |grep gmpz_get_str
000000000001c070 T __gmpz_get_str
So I guess that changing the empty definition (near line 100) in the MELT-Plugin-Makefile of the MELTGCC_LIBES make variable to
MELTGCC_LIBES= -lgmp
 might, if you are lucky, solve the issue.

However, I did not try that, so please try it and report (on this mailing list) if it solves the issue or not.
Perhaps you'll need to add some -L argument also

Hope this helps, regards

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Christophe Schmid

unread,
May 30, 2016, 8:38:45 AM5/30/16
to gcc-melt
Hello Basile,

Much thanks for your quick answer, very appreciable, so I'll attempt to be as quick as you ;)
Ok, I updated Makefile as you suggested and rebuild the whole using same settings as before already
After build and copy/install of resulting .so and proto headers/folders into my ARC GNU installation folder I tried the example again and here what I get below.
Seems melt.so still is catched at location /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/.
So I think your fix seemed to help regarding GMP linking but I try to instruct GCC -fplugin option to tell to use my melt.so in this location

--> /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/melt

and not this one

--> /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/

I think I simply need to find a way to tell ARC GNU gcc where to dlopen the melt.so of my choice (since I build two of them but only one matches) like "arc-elf32-gcc -fplugin=<ideally_I_give_absolute_path_here> ...

Thx Christophe


schmid@vmu13263:~/arc_gnu_gcc_plugin/melt_plugin$ arc-elf32-gcc -fplugin=melt -fplugin-arg-melt-mode=runfile -fplugin-arg-melt-arg=helloworld.melt -fplugin-arg-melt-i-am=Basile -c empty.c
cc1: note: MELT loading module #1 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-first [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-first] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-first.meltmod-9f10351251848809dc36a068c3b1be96.optimized.so generated at Tue May 24 09:08:09 2016 CEST built May 24 2016@09:08:14 (in C++)
cc1: note: MELT loading module #2 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-base [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-base] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-base.meltmod-ee575e1f21407df02f958e9b98db4a4e.optimized.so generated at Tue May 24 09:08:09 2016 CEST built May 24 2016@09:08:26 (in C++)
cc1: note: MELT loading module #3 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-debug [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-debug] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-debug.meltmod-56080b3b8501a7c6fba3d2e1fa0ff1e9.optimized.so generated at Tue May 24 09:08:09 2016 CEST built May 24 2016@09:08:36 (in C++)
cc1: note: MELT loading module #4 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-macro [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-macro] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-macro.meltmod-d04fc56d684b5cf46b3ff16ea3cd8858.optimized.so generated at Tue May 24 09:08:10 2016 CEST built May 24 2016@09:08:39 (in C++)
cc1: note: MELT loading module #5 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-moremacro [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-moremacro] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-moremacro.meltmod-3640ab11a1c093fa6d7ee223855f252b.optimized.so generated at Tue May 24 09:08:10 2016 CEST built May 24 2016@09:08:53 (in C++)
cc1: note: MELT loading module #6 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-normal [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-normal] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-normal.meltmod-42c645106786629174ea5d95b48d3acc.optimized.so generated at Tue May 24 09:08:11 2016 CEST built May 24 2016@09:08:55 (in C++)
cc1: note: MELT loading module #7 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-normatch [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-normatch] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-normatch.meltmod-2077210c5362a08320f08eb4fcb3a9a4.optimized.so generated at Tue May 24 09:08:12 2016 CEST built May 24 2016@09:09:10 (in C++)
cc1: note: MELT loading module #8 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-genobj [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-genobj] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-genobj.meltmod-06bf32fb01105a7ab7323d2235ee2ff3.optimized.so generated at Tue May 24 09:08:12 2016 CEST built May 24 2016@09:09:20 (in C++)
cc1: note: MELT loading module #9 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-outobj [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-outobj] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-outobj.meltmod-30828182c8a8b0bf94edc7c4a2646d24.optimized.so generated at Tue May 24 09:08:13 2016 CEST built May 24 2016@09:09:34 (in C++)
cc1: note: MELT loading module #10 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-hooks [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-hooks] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-hooks.meltmod-965bb0d3a703b6c8c2dacc93f6813ed0.optimized.so generated at Tue May 24 09:08:13 2016 CEST built May 24 2016@09:09:45 (in C++)
cc1: note: MELT loading module #11 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/warmelt-modes [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-modes] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-modes.meltmod-a5412855950e0df9b3331ea3d9019e8d.optimized.so generated at Tue May 24 09:08:13 2016 CEST built May 24 2016@09:09:51 (in C++)
cc1: note: MELT loading module #12 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/libmelt-ana-base [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-base] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-base.meltmod-f3af826ade68b0ac5729bf41b72a8bc1.optimized.so generated at Tue May 24 09:18:07 2016 CEST built May 24 2016@09:18:07 (in C++)
cc1: note: MELT loading module #13 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/libmelt-ana-tree [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-tree] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-tree.meltmod-d6571b4b40db0d6bb8838accd80b2941.optimized.so generated at Tue May 24 09:18:44 2016 CEST built May 24 2016@09:18:45 (in C++)
cc1: note: MELT loading module #14 for /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-sources/1.1.3/libmelt-ana-gimple [realpath /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-gimple] with /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/libmelt-ana-gimple.meltmod-e655b1df350faca0f44b023263662f7b.optimized.so generated at Tue May 24 09:19:52 2016 CEST built May 24 2016@09:19:52 (in C++)

SHORT BACKTRACE[#0] warmelt-base.cc:106157: MELT CHECK: meltmod__WARMELTmiBASE__initialmeltchunk_50 {putroutconst constnull.drout_3010__MULTIPLE_SORT#3};
#1:??
#2:@melt-runtime.cc:9539:: meltgc_start_module_by_index before starting #2 /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-base.meltmod-ee575e1f21407df02f958e9b98db4a4e.optimized.so ??
#3:@melt-runtime.cc:9578:: meltgc_start_all_new_modules before starting #2 module /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-modules/1.1.3/warmelt-base.meltmod-ee575e1f21407df02f958e9b98db4a4e.optimiz ??
#4:@melt-runtime.cc:10062:: meltgc_load_modules_and_do_mode before loading curmod @@ ??.

cc1: warning: warmelt-base.cc:106157: MELT CHECK FAILED <meltmod__WARMELTmiBASE__initialmeltchunk_50> : putroutconst constnull.drout_3010__MULTIPLE_SORT#3
 [enabled by default]
cc1: note: MELT inform: reading from MELT source file helloworld.melt
cc1: note: MELT generating C++ code of module /tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld
cc1: note: MELT generated new file /tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld.cc
cc1: note: MELT generated C++ code of module /tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld with 0 secondary files in 1 CPU millisec.

MELT is building binary helloworld from source /tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld with flavor quicklybuilt
MELT plugin running: make -s -f /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-module-1.1.3.mk GCCMELT_MODULE_SOURCEBASE=/tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld GCCMELT_MODULE_BINARYBASE=/users/schmid/arc_gnu_gcc_plugin/melt_plugin/helloworld  MELTGCC_BUILD_WITH_CXX=YesPlugin GCCMELT_CFLAGS=-I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-headers/1.1.3\ -I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include\ -I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/c-family\ \ -DIN_GCC\ -DMELT_IS_PLUGIN\ -O  GCCMELT_MODULE_WORKSPACE=/tmp/fileyqqkJQ-GccMeltTmp-163b447b/ GCCMELT_MODULE_FLAVOR=quicklybuilt melt_module
g++: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [/tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld.b44ff73e8bd9a38226cdcacb6fb9a7ff.descriptor.meltpic.o] Error 1
cc1: error: MELT fatal failure from melt-runtime.cc:5606 [MELT built May 30 2016, version 1.1.3 [melt-branch_revision_217521]]
cc1: note: MELT failed at melt-runtime.cc:5606 in directory /users/schmid/arc_gnu_gcc_plugin/melt_plugin

SHORT BACKTRACE[#0] MELT fatal failure;
#1:@melt-runtime.cc:5856:: melt_compile_source srcbase /tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld binbase helloworld flavor quicklybuilt ??
#2:<RUNFILE_DOCMD @warmelt-modes.melt:74>
  warmelt-modes.meltmod-a5412855950e0df9b3331ea3d9019e8d.optimized.so

#3:!<HOOK_MELT_DO_INITIAL_MODE>
  warmelt-hooks.meltmod-965bb0d3a703b6c8c2dacc93f6813ed0.optimized.so [melthook_HOOK_MELT_DO_INITIAL_MODE=0x7f024face0e0]

#4:@melt-runtime.cc:10150:: meltgc_load_modules_and_do_mode before #0 initial mode runfile ??.

cc1: note: MELT failure with loaded module #1: warmelt-first.meltmod-9f10351251848809dc36a068c3b1be96.optimized.so generated on Tue May 24 09:08:09 2016 CEST
cc1: note: MELT failure with loaded module #2: warmelt-base.meltmod-ee575e1f21407df02f958e9b98db4a4e.optimized.so generated on Tue May 24 09:08:09 2016 CEST
cc1: note: MELT failure with loaded module #3: warmelt-debug.meltmod-56080b3b8501a7c6fba3d2e1fa0ff1e9.optimized.so generated on Tue May 24 09:08:09 2016 CEST
cc1: note: MELT failure with loaded module #4: warmelt-macro.meltmod-d04fc56d684b5cf46b3ff16ea3cd8858.optimized.so generated on Tue May 24 09:08:10 2016 CEST
cc1: note: MELT failure with loaded module #5: warmelt-moremacro.meltmod-3640ab11a1c093fa6d7ee223855f252b.optimized.so generated on Tue May 24 09:08:10 2016 CEST
cc1: note: MELT failure with loaded module #6: warmelt-normal.meltmod-42c645106786629174ea5d95b48d3acc.optimized.so generated on Tue May 24 09:08:11 2016 CEST
cc1: note: MELT failure with loaded module #7: warmelt-normatch.meltmod-2077210c5362a08320f08eb4fcb3a9a4.optimized.so generated on Tue May 24 09:08:12 2016 CEST
cc1: note: MELT failure with loaded module #8: warmelt-genobj.meltmod-06bf32fb01105a7ab7323d2235ee2ff3.optimized.so generated on Tue May 24 09:08:12 2016 CEST
cc1: note: MELT failure with loaded module #9: warmelt-outobj.meltmod-30828182c8a8b0bf94edc7c4a2646d24.optimized.so generated on Tue May 24 09:08:13 2016 CEST
cc1: note: MELT failure with loaded module #10: warmelt-hooks.meltmod-965bb0d3a703b6c8c2dacc93f6813ed0.optimized.so generated on Tue May 24 09:08:13 2016 CEST
cc1: note: MELT failure with loaded module #11: warmelt-modes.meltmod-a5412855950e0df9b3331ea3d9019e8d.optimized.so generated on Tue May 24 09:08:13 2016 CEST
cc1: note: MELT failure with loaded module #12: libmelt-ana-base.meltmod-f3af826ade68b0ac5729bf41b72a8bc1.optimized.so generated on Tue May 24 09:18:07 2016 CEST
cc1: note: MELT failure with loaded module #13: libmelt-ana-tree.meltmod-d6571b4b40db0d6bb8838accd80b2941.optimized.so generated on Tue May 24 09:18:44 2016 CEST
cc1: note: MELT failure with loaded module #14: libmelt-ana-gimple.meltmod-e655b1df350faca0f44b023263662f7b.optimized.so generated on Tue May 24 09:19:52 2016 CEST
cc1: note: MELT got fatal failure from melt-runtime.cc:5606
cc1: warning: MELT temporary directory /tmp/fileyqqkJQ-GccMeltTmp-163b447b may be dirty on fatal failure; please remove it manually [enabled by default]
cc1: fatal error: MELT plugin module compilation failed (512) in /users/schmid/arc_gnu_gcc_plugin/melt_plugin for command make -s -f /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-module-1.1.3.mk GCCMELT_MODULE_SOURCEBASE=/tmp/fileyqqkJQ-GccMeltTmp-163b447b/helloworld GCCMELT_MODULE_BINARYBASE=/users/schmid/arc_gnu_gcc_plugin/melt_plugin/helloworld  MELTGCC_BUILD_WITH_CXX=YesPlugin GCCMELT_CFLAGS=-I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/melt-headers/1.1.3\ -I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include\ -I\ /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/include/c-family\ \ -DIN_GCC\ -DMELT_IS_PLUGIN\ -O  GCCMELT_MODULE_WORKSPACE=/tmp/fileyqqkJQ-GccMeltTmp-163b447b/ GCCMELT_MODULE_FLAVOR=quicklybuilt melt_module
compilation terminated.

Basile Starynkevitch

unread,
May 30, 2016, 9:53:08 AM5/30/16
to gcc-...@googlegroups.com
On 05/30/2016 02:38 PM, Christophe Schmid wrote:
> Hello Basile,
>
> Much thanks for your quick answer, very appreciable, so I'll attempt
> to be as quick as you ;)
> Ok, I updated Makefile as you suggested and rebuild the whole using
> same settings as before already
> After build and copy/install of resulting .so and proto
> headers/folders into my ARC GNU installation folder I tried the
> example again and here what I get below.
> Seems melt.so still is catched at location
> /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/.
> So I think your fix seemed to help regarding GMP linking but I try to
> instruct GCC -fplugin option to tell to use my melt.so in this location
>
> -->
> /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/melt
>
> and not this one
>
> --> /usr/lib/gcc/x86_64-linux-gnu/4.8/plugin/
>
> I think I simply need to find a way to tell ARC GNU gcc where to
> dlopen the melt.so of my choice (since I build two of them but only
> one matches) like "arc-elf32-gcc
> -fplugin=<ideally_I_give_absolute_path_here> ...


Yes, I would suggest you to give an absolute path to -fplugin=;
alternatively, you might make a symlink arcmelt.so -> melt.so (in the
appropriate directory) and use -fplugin=arcmelt

I'm not sure to understand all your issues; in particular, do you
understand well what the -fplugin= option mean to GCC, and did you read
all the relevant GCC documentation?

Perhaps you should copy all the MELT generated files which are not *.o
or *.so files from your straight GCC to the cross-compiler.

Cheers.

Christophe Schmid

unread,
May 30, 2016, 10:01:22 AM5/30/16
to gcc-melt
I already read a lot GNU documentation but you're right I am new to MELT and writing plugins for GCC.
So I'll follow what you suggest (rename plugin and symlink) then retry and report back.
And yes I planned to read documentations/sources of MELT and GCC as well but it's huge and days only have 24 hours ... for the moment.

Thx Christophe


Le lundi 30 mai 2016 11:26:46 UTC+2, Christophe Schmid a écrit :

Christophe Schmid

unread,
May 30, 2016, 10:48:27 AM5/30/16
to gcc-melt
Ok did what you said adding a new symlink named arcmelt.so :

schmid@vmu13263:~/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin$ ll
total 2512
drwxr-xr-x  6 schmid Icc    4096 May 30 16:08 ./
drwxr-xr-x 26 schmid Icc    4096 May  4 12:40 ../
lrwxrwxrwx  1 schmid Icc      13 May 30 16:08 arcmelt.so -> melt-1.1.3.so*
-rw-r--r--  1 schmid Icc  555706 Jan 27 07:29 gtype.state
drwxr-xr-x  9 schmid Icc    4096 May 23 13:20 include/
-rwxr-xr-x  1 schmid Icc 1968981 May 30 13:06 melt-1.1.3.so*
drwxr-xr-x  3 schmid Icc    4096 May 30 13:47 melt-headers/
-rw-r--r--  1 schmid Icc   18370 May 30 13:47 melt-module-1.1.3.mk
drwxr-xr-x  3 schmid Icc    4096 May 30 13:47 melt-modules/
lrwxrwxrwx  1 schmid Icc      13 May 30 13:48 melt.so -> melt-1.1.3.so*
drwxr-xr-x  3 schmid Icc    4096 May 30 13:47 melt-sources/

Now trying to load such plugin gives that:

schmid@vmu13263:~/arc_gnu_gcc_plugin/melt_plugin$ arc-elf32-gcc -fplugin="/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/arcmelt" -fplugin-arg-melt-mode=runfile -fplugin-arg-melt-arg=helloworld.melt -fplugin-arg-melt-i-am=Basile -c empty.c
cc1: error: plugin melt should be specified before -fplugin-arg-melt-mode=runfile in the command line
cc1: error: plugin melt should be specified before -fplugin-arg-melt-arg=helloworld.melt in the command line
cc1: error: plugin melt should be specified before -fplugin-arg-melt-i-am=Basile in the command line
cc1: error: cannot load plugin /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/arcmelt
/users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/arcmelt: cannot open shared object file: No such file or directory

I need to understand how -fplugin option works hence read documentation. If you've a hint I'm your buyer, thanks. Christophe

Basile Starynkevitch

unread,
May 30, 2016, 10:51:46 AM5/30/16
to gcc-...@googlegroups.com
On 05/30/2016 04:48 PM, Christophe Schmid wrote:
> Ok did what you said adding a new symlink named arcmelt.so :
>
> schmid@vmu13263:~/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin$
> ll
> total 2512
> drwxr-xr-x 6 schmid Icc 4096 May 30 16:08 ./
> drwxr-xr-x 26 schmid Icc 4096 May 4 12:40 ../
> lrwxrwxrwx 1 schmid Icc 13 May 30 16:08 arcmelt.so -> melt-1.1.3.so*
> -rw-r--r-- 1 schmid Icc 555706 Jan 27 07:29 gtype.state
> drwxr-xr-x 9 schmid Icc 4096 May 23 13:20 include/
> -rwxr-xr-x 1 schmid Icc 1968981 May 30 13:06 melt-1.1.3.so*
> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-headers/
> -rw-r--r-- 1 schmid Icc 18370 May 30 13:47 melt-module-1.1.3.mk
> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-modules/
> lrwxrwxrwx 1 schmid Icc 13 May 30 13:48 melt.so -> melt-1.1.3.so*
> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-sources/


Then, all the MELT plugin arguments should start with
-fplugin-arg-arcmelt- ; this is not MELT specific:
https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html

Basile Starynkevitch

unread,
May 30, 2016, 10:55:18 AM5/30/16
to gcc-...@googlegroups.com
On 05/30/2016 04:51 PM, Basile Starynkevitch wrote:
> On 05/30/2016 04:48 PM, Christophe Schmid wrote:
>> Ok did what you said adding a new symlink named arcmelt.so :
>>
>> schmid@vmu13263:~/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin$
>> ll
>> total 2512
>> drwxr-xr-x 6 schmid Icc 4096 May 30 16:08 ./
>> drwxr-xr-x 26 schmid Icc 4096 May 4 12:40 ../
>> lrwxrwxrwx 1 schmid Icc 13 May 30 16:08 arcmelt.so ->
>> melt-1.1.3.so*
>> -rw-r--r-- 1 schmid Icc 555706 Jan 27 07:29 gtype.state
>> drwxr-xr-x 9 schmid Icc 4096 May 23 13:20 include/
>> -rwxr-xr-x 1 schmid Icc 1968981 May 30 13:06 melt-1.1.3.so*
>> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-headers/
>> -rw-r--r-- 1 schmid Icc 18370 May 30 13:47 melt-module-1.1.3.mk
>> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-modules/
>> lrwxrwxrwx 1 schmid Icc 13 May 30 13:48 melt.so -> melt-1.1.3.so*
>> drwxr-xr-x 3 schmid Icc 4096 May 30 13:47 melt-sources/
>
>
> Then, all the MELT plugin arguments should start with
> -fplugin-arg-arcmelt- ; this is not MELT specific:
> https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html

I forgot to mention: read also
https://gcc.gnu.org/onlinedocs/gccint/Plugins.html

Christophe Schmid

unread,
May 30, 2016, 12:14:50 PM5/30/16
to gcc-melt
Thanks for the links, they're useful and I read those.

I observe that for native Ubuntu gcc/g++ MELT build I get this after installation:

root@vmu13263:/usr/lib/gcc/x86_64-linux-gnu/4.8/plugin# ll
total 2684
drwxr-xr-x 6 root root    4096 May 24 09:35 ./
drwxr-xr-x 7 root root    4096 May 30 18:02 ../
-rwxr-xr-x 1 root root  175744 Jan 27 08:40 gengtype*
-rw-r--r-- 1 root root  555706 Jan 27 07:29 gtype.state
drwxr-xr-x 9 root root    4096 May 23 13:20 include/
-rwxr-xr-x 1 root root 1968981 May 24 09:00 melt-1.1.3.so*
drwxr-xr-x 3 root root    4096 May 24 09:35 melt-headers/
-rw-r--r-- 1 root root   18370 May 24 09:35 melt-module-1.1.3.mk
drwxr-xr-x 3 root root    4096 May 24 09:35 melt-modules/
lrwxrwxrwx 1 root root      13 May 24 09:35 melt.so -> melt-1.1.3.so*
drwxr-xr-x 3 root root    4096 May 24 09:35 melt-sources/

For ARC GNU x-compiler I get shis (following same installation instructions):

root@vmu13263:/usr/lib/gcc/arc-elf32/4.8.5/plugin# ll
total 1964
drwxr-xr-x 5 schmid Icc     4096 May 30 17:21 ./
drwxr-xr-x 3 schmid Icc     4096 May 30 13:47 ../
lrwxrwxrwx 1 root   root      13 May 30 17:21 arcmelt.so -> melt-1.1.3.so*

-rwxr-xr-x 1 schmid Icc  1968981 May 30 13:06 melt-1.1.3.so*
drwxr-xr-x 3 schmid Icc     4096 May 30 13:47 melt-headers/
-rw-r--r-- 1 schmid Icc    18370 May 30 13:47 melt-module-1.1.3.mk
drwxr-xr-x 3 schmid Icc     4096 May 30 13:47 melt-modules/
drwxr-xr-x 3 schmid Icc     4096 May 30 13:47 melt-sources/

So for ARC GNU I am missing two items: gengtype, gtype.state. So brought those into the folder as well:

cp /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/libexec/gcc/arc-elf32/4.8.5/plugin/gengtype .
cp /users/schmid/arc_gnu/arc_gnu_2016.03_prebuilt_elf32_le_linux_install/lib/gcc/arc-elf32/4.8.5/plugin/gtype.state .

But that didn't help.

May I ask you if you could attempt to build MELT against ARC GNU 2016.03 please?
URL: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases

I think we will be faster in doing so if you don't mind.

Thanks Christophe

Basile Starynkevitch

unread,
May 30, 2016, 1:24:03 PM5/30/16
to gcc-...@googlegroups.com
On 05/30/2016 06:14 PM, Christophe Schmid wrote:
> Thanks for the links, they're useful and I read those.
>
> So for ARC GNU I am missing two items: gengtype, gtype.state. So
> brought those into the folder as well:

This cannot work. the gtype.state textual file conveys a description (or
some meta-data) describing all the GTY-ed datatype used by your GCC
compiler (see
https://gcc.gnu.org/onlinedocs/gccint/Type-Information.html for more),
and is specific to the particular version of that GCC compiler.

On a Debian system, the gcc-plugin-5-dev package is providing the
gengtype & gtype.state for the gcc-5 (straight) compiler, and while
Debian is packaging some cross compilers, it does not package the plugin
support for them.

So I am afraid you need to build your GCC cross-compiler from its source
code. Don't forget to pass --enable-plugins at configure time.

There is nothing MELT specific yet in this; you'll have the same issues
if using any other GCC plugin. GCC plugins are extremely
compiler-version & compiler-configuration sensitive.

Since you need to build your GCC cross-compiler from source code, I
strongly suggest (if that is possible) to build a newer GCC (for example
some GCC 6.1, or GCC 5.3) from the pristine FSF source tree. So look on
https://gcc.gnu.org/mirrors.html and download a copy of
gcc-6.1.0.tar.bz2 or of gcc-5.3.0.tar.bz2 (or maybe gcc-4.9.3.tar.bz2)

Then read carefully the instructions on
https://gcc.gnu.org/install/configure.html and read them twice.

Good luck!
Reply all
Reply to author
Forward
0 new messages