Author Topic: Compiling Issues  (Read 3146 times)

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Compiling Issues
« on: October 13, 2007, 08:25:22 pm »
I've recently been getting "multiple definitions of xyz: first defined here" errors when I try to build stuff. What causes them? I'm assuming that since I'm trying to build stable/release code, it's not a code error.

I'm using the flags:
Code: [Select]
-O3 -mtune=xscale -mcpu=xscale -ffast-math -fomit-frame-pointer -fno-common
I copied the ZGCC image contents to a MD partition and took some stuff (SDL headers, OGG/Vorbis headers, etc) that I have from my own builds.

Any help would be much appreciated.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

adf

  • Hero Member
  • *****
  • Posts: 2807
    • View Profile
    • http://
Compiling Issues
« Reply #1 on: October 13, 2007, 11:35:05 pm »
Quote from: Capn_Fish
I've recently been getting "multiple definitions of xyz: first defined here" errors when I try to build stuff. What causes them? I'm assuming that since I'm trying to build stable/release code, it's not a code error.

I'm using the flags:
Code: [Select]
-O3 -mtune=xscale -mcpu=xscale -ffast-math -fomit-frame-pointer -fno-common
I copied the ZGCC image contents to a MD partition and took some stuff (SDL headers, OGG/Vorbis headers, etc) that I have from my own builds.

Any help would be much appreciated.
After all  this technical stuff, you still haven't told us what this "Issues," you said you were going to compile even does
**3100 Zubuntu Jaunty,(working on Cacko dualboot), 16G A-Data internal CF, 4G SD, Ambicom WL-1100C Cf, linksys usb ethernet,  BelkinF8T020 BT card, Belkin F8U1500-E Ir kbd, mini targus usb mouse, rechargeble AC/DC powered USB hub, psp cables and battery extenders.

**6000l  Tetsuized Sharprom, installed on internal flash only 1G sd, 2G cf

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Compiling Issues
« Reply #2 on: October 14, 2007, 10:48:07 am »
Sure I did. The "Error: multiple definitions of xyz: first defined here" errors. They just cause the build to stop/fail.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Compiling Issues
« Reply #3 on: October 14, 2007, 08:11:14 pm »
It's a link error. You have the same function defined more than once at object level (.o).

For example, file1.c  defines function doA() and file2.c also defines doA() - the linker doesn't know which function to link to.

Just because you are using "stable/release" code doesn't mean it is guaranteed to compile out of the box on any other system.
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Compiling Issues
« Reply #4 on: October 14, 2007, 08:49:29 pm »
OK, so going into the code and editing it is the way to go. I assume I should send patches to the devs as well?

Thanks.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Compiling Issues
« Reply #5 on: October 14, 2007, 10:30:27 pm »
Quote from: Capn_Fish
OK, so going into the code and editing it is the way to go. I assume I should send patches to the devs as well?

Thanks.

You should do a grep to find which functions are duplicated in which files.

It could be that your compiler is too old so didn't make a distinctive enough name for the linker. It could be that those extra files you mentioned are being linked too and causing confusion. If the code is C++ then you have to get into name mangling... Anyway, I'm just trying to say that it could be you have a broken set up and there is no problem in the original code. On the other hand a lot of projects release broken source code.
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Compiling Issues
« Reply #6 on: October 15, 2007, 06:08:05 pm »
I guess the pdaX compiler is broken, the code builds fine on my Debian box.

EDIT: Turning off my custom flags seems to make it build OK. I'm trying now with only
Code: [Select]
-O3 -mtune=xscale -mcpu=xscale
EDIT2: That worked, so I guess using some options can cause the compiler to break.
« Last Edit: October 15, 2007, 07:45:03 pm by Capn_Fish »
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo