Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Using emulator on ubuntu fails

Hi all,

I have an opencl project that compiles and runs on Redhat just fine. I have installed Quartus/etc on my ubuntu machine as well. The executable created on Redhat runs fine on Ubuntu. When I try to compile on Ubuntu it goes well:

$ cc -o host host.o misc.o misc_cl.o -L/home/mps/altera/14.1/hld/board/s5phq/linux64/lib -L/home/mps/altera/14.1/hld/host/linux64/lib -lalteracl -lacl_emulator_kernel_rt -lalterahalmmd -laltera_s5phq_mmd -lelf -lrt -ldl -lstdc++

But I get a runtime failure with the emulator. Following shows my LD_LIBRARY_PATH, which DOES include libacl_emulator_kernel_rt.so:

$ echo $LD_LIBRARY_PATH

/home/mps/altera/14.1/hld/host/linux64/lib:/home/mps/altera/14.1/hld/board/s5phq/linux64/lib

$./host

ntest 1 ncyles/test 100000

Emulator runtime library missing in host program. Please relink host with -lacl_emulator_kernel_rt

Any help or ideas?

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I am facing the same issue on Ubuntu 14.04. The LD_LIBRARY_PATH contains the location where the library is present.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi there,

    I have exactly the same issue on ubuntu 14.04 and 14.10 setups running hld 14.0 and 15.0

    the -march=emulate flags works fine with aoc, builds the emulated kernel, but issuing the corresponding host binary command with CL_CONTEXT_EMULATOR_DEVICE_ALTERA=p385_hpc_a7 ./hello_world

    fails with:

    Emulator runtime library missing in host program. Please relink host with -lacl_emulator_kernel_rt

    the "aocl link-config" shows that the emulator lib being provided and its in LD_LIBRARY_PATH, however the ldd of the resulting host binary does not show the lib is being linked against:

    # aocl link-config

    -L/root/altera/14.0/hld/board/nalla_pcie//linux64/lib -L/root/altera/14.0/hld/host/linux64/lib -lalteracl -ldl -lacl_emulator_kernel_rt -lalterahalmmd -lnalla_pcie_mmd -lelf -lrt -lstdc++"

    # ldd bin/hello_world

    linux-vdso.so.1 => (0x00007fff419c8000)

    libalteracl.so => /root/altera/14.0/hld/host/linux64/lib/libalteracl.so (0x00007f06fc1b0000)

    libalterahalmmd.so => /root/altera/14.0/hld/host/linux64/lib/libalterahalmmd.so (0x00007f06fafa0000)

    libnalla_pcie_mmd.so => /root/altera/14.0/hld/board/nalla_pcie/linux64/lib/libnalla_pcie_mmd.so (0x00007f06fa568000)

    libelf.so.0 => /usr/lib/x86_64-linux-gnu/libelf.so.0 (0x00007f06fa350000)

    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f06fa140000)

    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f06f9e38000)

    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f06f9c20000)

    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f06f9858000)

    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f06f9638000)

    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f06f9330000)

    /lib64/ld-linux-x86-64.so.2 (0x00007f0705598000)

    many thanks for your responses
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Apparently, Ubuntu/Debian tool-chain passes --as-needed flag to the linker by default.

    We should add --no-as-needed flag to ensure correct linking.

    This is worked for my 64 bit OPENCL SDK 14.0 installation on Ubuntu 14.04 LTS.

    Change the makefile linking Flag as below:

    default: AOCL_LINK_CONFIG := $(shell aocl link-config)

    fixed: AOCL_LINK_CONFIG := -Wl,--no-as-needed $(shell aocl link-config)

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi.. Altera open CL SDK is not supporting ubuntu operating system from the way beginning. you should keep your self in cent os