Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I am trying to build a portable executable emulator using libemu. However I am having this linker problem when I try to build: stolas@devbox:~/git/libemu/tools/emulate_exe$ gcc `pkg-config --cflags --libs libemu` ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429

    Linking Issue


    Hello,

    I am trying to build a portable executable emulator using libemu.
    However I am having this linker problem when I try to build:
    stolas@devbox:~/git/libemu/tools/emulate_exe$ gcc `pkg-config --cflags --libs libemu` main.c -o emu_exe
    main.c: In function ‘main’:
    main.c:127:9: warning: assignment makes pointer from integer without a cast (enabled by default)
    /tmp/cc2vGq79.o: In function `main':
    main.c:(.text+0x6d): undefined reference to `emu_new'
    main.c:(.text+0x7d): undefined reference to `emu_cpu_get'
    main.c:(.text+0x8d): undefined reference to `emu_mem_get'
    main.c:(.text+0xb8): undefined reference to `emu_memory_write_block'
    main.c:(.text+0xdf): undefined reference to `emu_memory_write_block'
    main.c:(.text+0xf6): undefined reference to `emu_cpu_eip_set'
    main.c:(.text+0x102): undefined reference to `emu_cpu_run'
    main.c:(.text+0x10e): undefined reference to `emu_free'
    collect2: ld returned 1 exit status

    first I checked if the pkg-config was working like expected:
    stolas@devbox:~/git/libemu/tools/emulate_exe$ pkg-config --cflags --libs libemu
    -I/opt/libemu/include -L/opt/libemu/lib -lemu

    Seems like it did.
    After that I checked if the Symbols were exported correctly:
    stolas@devbox:ls -alh /opt/libemu/lib/
    -rwxr-xr-x 1 root root 933 Dec 3 10:15 libemu.la
    lrwxrwxrwx 1 root root 15 Dec 3 10:15 libemu.so -> libemu.so.2.0.0
    lrwxrwxrwx 1 root root 15 Dec 3 10:15 libemu.so.2 -> libemu.so.2.0.0
    -rwxr-xr-x 1 root root 1.7M Dec 3 10:15 libemu.so.2.0.0
    stolas@devbox:~/git/libemu/tools/emulate_exe$ objdump -t /opt/libemu/lib/libemu.so.2.0.0 | grep emu_cpu_get
    000174a0 g F .text 00000008 emu_cpu_get


    My system info:
    stolas@devbox:~/git/libemu/tools/emulate_exe$ uname -a ; gcc --version ; ld -V
    Linux devbox 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux
    gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
    Copyright (C) 2011 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    GNU ld (GNU Binutils for Ubuntu) 2.22
    Supported emulations:
    elf_i386
    i386linux
    elf32_x86_64
    elf_x86_64
    elf_l1om
    elf_k1om

    I am completely flabbergasted.
    Anyone an idea how I can continue? Maybe I am missing something.
    I just need to get this linker to work.


    - Cheers
    New Users, please read this..
    Google first, then ask..

  2. #2
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    152
    What happens when you try:

    Code:
    gcc main.c `pkg-config --cflags --libs libemu` -o emu_exe
    Programming and other random guff: cat /dev/thoughts > blogspot.com (previously prognix.blogspot.com)

  3. #3
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,429
    Thanks it works.
    I feel retarded..
    New Users, please read this..
    Google first, then ask..

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •