1

I'm not a native speaker, but I will try my best in English.

For a self-made program I need some libraries (which are from someone else). On my first Linux PC it worked, but now on this PC it doesn't work. I install the programs with sudo make, and the libraries are copied to /usr/local/lib/.

Now I try to compile my program with g++ -g -o cv countvertices.c -lQuantim4 -lm -ltiff -lPSgraf3 and it says:

/usr/bin/ld: skipping incompatible /usr/local/lib/libQuantim4.a when searching for -lQuantim4
/usr/bin/ld: cannot find -lQuantim4
/usr/bin/ld: skipping incompatible /usr/local/lib/libPSgraf3.a when searching for -lPSgraf3
/usr/bin/ld: cannot find -lPSgraf3
collect2: ld gab 1 als Ende-Status zurück

I searched a bit about this error message, and it looks like it has something to do with 32/64-bit versions. The processor is AMD Athlon(tm) II X2 215 Processor × 2. I installed Ubuntu 11.10. desktop version (i386) with windows installer wubi. So now I have a 32 bit version of Ubuntu.

Does someone have an idea how to solve this problem? Or is there a way to see whether the libraries are 32 bit or 64 bit?


Thank you for your answer, steabert.

The library architecture is x86_64. But I thought if I run the makefile, the appropriate architecture would be created. The makefile for Quantim4 looks like this:

# make
#
#
#  Quantim library (version 2.0)
#
NAME   = libQuantim4
#
VPATH = /usr/include
#
CC = g++
#
#  source files
#
CFILES = SavePaletteImage.c SaveShiftImage.c SetFrame.c StretchHisto.c bAddition.c bContour.c bErode.c bLogAnd.c bLogOr.c bObjects.c gBibin.c gBin.c gBilevel.c gBinTwoLevel.c gErode.c b2DEuler.c pDisector.c BtdErode.c BtdErodeFilter.c BtdOpen.c  BtdContinuity.c SetBtdShell.c  DLine.c bContourCent.c  RGBtoGray.c  StretchRGBHisto.c StretchRGBBright.c ran3.c  GetRandDDDImage.c  CreateDDDImage.c gDiff.c error.c DddMinMax.c DddBin.c DddClas.c BtdEuler.c DddHisto.c DddCircHisto.c DddEulerFunc.c psPlot.c psDddCircHisto.c qdefault.c GetCorDDDImage.c grf3.c GetDddGreyCdf.c psMultiPlot.c gLaplace.c gSobel.c gHisto.c psHisto.c bThinning.c  bConCom.c bHitMiss.c  DddResRed.c GetDddAcov.c gRedRes.c BtdVolSurf.c BtdSkelet.c BtdDiffusionZ.c BtdEuler26.c BtdEuler6.c BtdMeancurv.c BtdQuant.c BtdSurfdens.c BtdVoldens.c GetAcov.c GetCorImage.c  GetGreyCdf.c MinMaxf.c gConfunc.c bConCom2.c gCircMask.c bRemObjects.c GetCorDDDImage2.c Btd2Ddd.c grf2ext.c GetSemiVar.c psMultiPlotTit.c psPlotTit.c utils.c GetVoronoiTes.c GetPercolClus.c bQuant.c bEuler4.c bEuler8.c bLengthdens.c bSurfdens.c bVoldens.c bAverageCurvature.c DddBibin.c gHistoMatch.c rgb-utils.c BtdQuantMask.c bQuantMask.c bQuantRecMask.c  bErodeMark.c bGetDistMap.c BtdDrawSphere.c BtdErodeMir.c BtdGetDistMap.c BtdGetDistOpenMap.c DDD2Dx.c DddDrawCylinder.c DddWaterShed.c gWaterShed.c SetDddShell.c bErodeMir.c bErodeMirCirc.c bGetDistOpenMap.c bThinning8.c BtdGetDistOpenMapDouble.c BtdErodeMirDouble.c ps3Dview.c GetRandImage.c files.c pixelrw.c transforms.c filters.c mathmorph.c bGetFullDistMap.c evaluations.c binarization.c Erode_Open.c greyscale.c minkowski.c binimages.c CircMask.c bConLength.c\
    ${NULL}
# 
#  compiler flags 
# 
CFLAGS = -O3 -w -r -L/usr/lib -L ~/local/lib -I ~/local/include 
#
#  rules 
# 
SRCFILES = $(CFILES)  
OBJFILES = $(CFILES:%.c=../bin/%.o) 

$(NAME): compile createLibrary;

compile: $(OBJFILES) 
#   touch emptyfile
#   $(CC) -o $@ $(CFLAGS) $(OBJFILES) -ltiff -lm

$(OBJFILES): ../bin/%.o: %.c
    $(CC) -c $(CFLAGS) $< -o $@
createLibrary:
    ar r libQuantim4.a $(OBJFILES) 
    ranlib libQuantim4.a
    cp libQuantim4.a /usr/local/lib/libQuantim4.a
    cp quantim4.h /usr/local/include/
clean:
    rm -f ../bin/*.o

If I run this with "sudo make", why do I get a x86_64 library when I actually have i386?


The log when I try to compile as normal user:

make | tee build.log
ar: creating libQuantim4.a
ar r libQuantim4.a ../bin/SavePaletteImage.o ../bin/SaveShiftImage.o ../bin/SetFrame.o ../bin/StretchHisto.o ../bin/bAddition.o ../bin/bContour.o ../bin/bErode.o ../bin/bLogAnd.o ../bin/bLogOr.o ../bin/bObjects.o ../bin/gBibin.o ../bin/gBin.o ../bin/gBilevel.o ../bin/gBinTwoLevel.o ../bin/gErode.o ../bin/b2DEuler.o ../bin/pDisector.o ../bin/BtdErode.o ../bin/BtdErodeFilter.o ../bin/BtdOpen.o ../bin/BtdContinuity.o ../bin/SetBtdShell.o ../bin/DLine.o ../bin/bContourCent.o ../bin/RGBtoGray.o ../bin/StretchRGBHisto.o ../bin/StretchRGBBright.o ../bin/ran3.o ../bin/GetRandDDDImage.o ../bin/CreateDDDImage.o ../bin/gDiff.o ../bin/error.o ../bin/DddMinMax.o ../bin/DddBin.o ../bin/DddClas.o ../bin/BtdEuler.o ../bin/DddHisto.o ../bin/DddCircHisto.o ../bin/DddEulerFunc.o ../bin/psPlot.o ../bin/psDddCircHisto.o ../bin/qdefault.o ../bin/GetCorDDDImage.o ../bin/grf3.o ../bin/GetDddGreyCdf.o ../bin/psMultiPlot.o ../bin/gLaplace.o ../bin/gSobel.o ../bin/gHisto.o ../bin/psHisto.o ../bin/bThinning.o ../bin/bConCom.o ../bin/bHitMiss.o ../bin/DddResRed.o ../bin/GetDddAcov.o ../bin/gRedRes.o ../bin/BtdVolSurf.o ../bin/BtdSkelet.o ../bin/BtdDiffusionZ.o ../bin/BtdEuler26.o ../bin/BtdEuler6.o ../bin/BtdMeancurv.o ../bin/BtdQuant.o ../bin/BtdSurfdens.o ../bin/BtdVoldens.o ../bin/GetAcov.o ../bin/GetCorImage.o ../bin/GetGreyCdf.o ../bin/MinMaxf.o ../bin/gConfunc.o ../bin/bConCom2.o ../bin/gCircMask.o ../bin/bRemObjects.o ../bin/GetCorDDDImage2.o ../bin/Btd2Ddd.o ../bin/grf2ext.o ../bin/GetSemiVar.o ../bin/psMultiPlotTit.o ../bin/psPlotTit.o ../bin/utils.o ../bin/GetVoronoiTes.o ../bin/GetPercolClus.o ../bin/bQuant.o ../bin/bEuler4.o ../bin/bEuler8.o ../bin/bLengthdens.o ../bin/bSurfdens.o ../bin/bVoldens.o ../bin/bAverageCurvature.o ../bin/DddBibin.o ../bin/gHistoMatch.o ../bin/rgb-utils.o ../bin/BtdQuantMask.o ../bin/bQuantMask.o ../bin/bQuantRecMask.o ../bin/bErodeMark.o ../bin/bGetDistMap.o ../bin/BtdDrawSphere.o ../bin/BtdErodeMir.o ../bin/BtdGetDistMap.o ../bin/BtdGetDistOpenMap.o ../bin/DDD2Dx.o ../bin/DddDrawCylinder.o ../bin/DddWaterShed.o ../bin/gWaterShed.o ../bin/SetDddShell.o ../bin/bErodeMir.o ../bin/bErodeMirCirc.o ../bin/bGetDistOpenMap.o ../bin/bThinning8.o ../bin/BtdGetDistOpenMapDouble.o ../bin/BtdErodeMirDouble.o ../bin/ps3Dview.o ../bin/GetRandImage.o ../bin/files.o ../bin/pixelrw.o ../bin/transforms.o ../bin/filters.o ../bin/mathmorph.o ../bin/bGetFullDistMap.o ../bin/evaluations.o ../bin/binarization.o ../bin/Erode_Open.o ../bin/greyscale.o ../bin/minkowski.o ../bin/binimages.o ../bin/CircMask.o ../bin/bConLength.o  
ranlib libQuantim4.a
cp libQuantim4.a /usr/local/lib/libQuantim4.a
cp: reguläre Datei „/usr/local/lib/libQuantim4.a“ kann nicht angelegt werden: Keine Berechtigung
make: *** [createLibrary] Fehler 1

The contents of build.log:

ar r libQuantim4.a ../bin/SavePaletteImage.o ../bin/SaveShiftImage.o ../bin/SetFrame.o ../bin/StretchHisto.o ../bin/bAddition.o ../bin/bContour.o ../bin/bErode.o ../bin/bLogAnd.o ../bin/bLogOr.o ../bin/bObjects.o ../bin/gBibin.o ../bin/gBin.o ../bin/gBilevel.o ../bin/gBinTwoLevel.o ../bin/gErode.o ../bin/b2DEuler.o ../bin/pDisector.o ../bin/BtdErode.o ../bin/BtdErodeFilter.o ../bin/BtdOpen.o ../bin/BtdContinuity.o ../bin/SetBtdShell.o ../bin/DLine.o ../bin/bContourCent.o ../bin/RGBtoGray.o ../bin/StretchRGBHisto.o ../bin/StretchRGBBright.o ../bin/ran3.o ../bin/GetRandDDDImage.o ../bin/CreateDDDImage.o ../bin/gDiff.o ../bin/error.o ../bin/DddMinMax.o ../bin/DddBin.o ../bin/DddClas.o ../bin/BtdEuler.o ../bin/DddHisto.o ../bin/DddCircHisto.o ../bin/DddEulerFunc.o ../bin/psPlot.o ../bin/psDddCircHisto.o ../bin/qdefault.o ../bin/GetCorDDDImage.o ../bin/grf3.o ../bin/GetDddGreyCdf.o ../bin/psMultiPlot.o ../bin/gLaplace.o ../bin/gSobel.o ../bin/gHisto.o ../bin/psHisto.o ../bin/bThinning.o ../bin/bConCom.o ../bin/bHitMiss.o ../bin/DddResRed.o ../bin/GetDddAcov.o ../bin/gRedRes.o ../bin/BtdVolSurf.o ../bin/BtdSkelet.o ../bin/BtdDiffusionZ.o ../bin/BtdEuler26.o ../bin/BtdEuler6.o ../bin/BtdMeancurv.o ../bin/BtdQuant.o ../bin/BtdSurfdens.o ../bin/BtdVoldens.o ../bin/GetAcov.o ../bin/GetCorImage.o ../bin/GetGreyCdf.o ../bin/MinMaxf.o ../bin/gConfunc.o ../bin/bConCom2.o ../bin/gCircMask.o ../bin/bRemObjects.o ../bin/GetCorDDDImage2.o ../bin/Btd2Ddd.o ../bin/grf2ext.o ../bin/GetSemiVar.o ../bin/psMultiPlotTit.o ../bin/psPlotTit.o ../bin/utils.o ../bin/GetVoronoiTes.o ../bin/GetPercolClus.o ../bin/bQuant.o ../bin/bEuler4.o ../bin/bEuler8.o ../bin/bLengthdens.o ../bin/bSurfdens.o ../bin/bVoldens.o ../bin/bAverageCurvature.o ../bin/DddBibin.o ../bin/gHistoMatch.o ../bin/rgb-utils.o ../bin/BtdQuantMask.o ../bin/bQuantMask.o ../bin/bQuantRecMask.o ../bin/bErodeMark.o ../bin/bGetDistMap.o ../bin/BtdDrawSphere.o ../bin/BtdErodeMir.o ../bin/BtdGetDistMap.o ../bin/BtdGetDistOpenMap.o ../bin/DDD2Dx.o ../bin/DddDrawCylinder.o ../bin/DddWaterShed.o ../bin/gWaterShed.o ../bin/SetDddShell.o ../bin/bErodeMir.o ../bin/bErodeMirCirc.o ../bin/bGetDistOpenMap.o ../bin/bThinning8.o ../bin/BtdGetDistOpenMapDouble.o ../bin/BtdErodeMirDouble.o ../bin/ps3Dview.o ../bin/GetRandImage.o ../bin/files.o ../bin/pixelrw.o ../bin/transforms.o ../bin/filters.o ../bin/mathmorph.o ../bin/bGetFullDistMap.o ../bin/evaluations.o ../bin/binarization.o ../bin/Erode_Open.o ../bin/greyscale.o ../bin/minkowski.o ../bin/binimages.o ../bin/CircMask.o ../bin/bConLength.o  
ranlib libQuantim4.a
cp libQuantim4.a /usr/local/lib/libQuantim4.a

The library architecture:

objdump -a /usr/local/lib/libQuantim4.a
In archive /usr/local/lib/libQuantim4.a:

SavePaletteImage.o:     file format elf64-x86-64
rw------- 1000/1000   4248 Jan 16 21:33 2011 SavePaletteImage.o


SaveShiftImage.o:     file format elf64-x86-64
rw------- 1000/1000   2280 Jan 16 21:33 2011 SaveShiftImage.o
...

But wait a moment, x86 means 32-bit, right? And i386 also is 32-bit. So where is the problem?

2
  • Can you build the library as a regular user, running make | tee build.log and post the contents of the file build.log?
    – steabert
    Jan 16, 2012 at 14:58
  • About x86 and 32-bit: x86_64 means it is 64-bit. You are correct in that i386 is 32-bit. Jan 20, 2012 at 12:59

2 Answers 2

1

I finally solved the problem by installing Ubuntu 11.10. amd64, although I wished there was a better way...

0

To find out for which architecture the library archive was compiled, run the command

$ objdump -a /usr/local/lib/libQuantim4.a

The target architecture of the library archive needs to match the architecture of the object files you are producing when compiling. Your options:

  1. Obtain library files for the correct architecture or recompile the library.
  2. Cross-compile to the same architecture as your library.

The second options will require all necessary libraries to be available in the target architecture (e.g. libc), and the resulting code will not run under that Ubuntu installation. So if the intention is to run it under Ubuntu i386, I would go for the first option.

If the library target architecture is x86_64 and you cannot obtain the library for i386, you could install Ubuntu 64bit.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .