WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED]collect2: ld returned 1 exit status  (Read 23806 times)

aus9

  • Guest
[SOLVED]collect2: ld returned 1 exit status
« on: March 30, 2013, 05:02:19 AM »
Hi

I know that cups 1.4.8 already exists but I have failed to re-compile later versions so thought I would try to re-compile 1.4.8 and once I learnt how to do it, try to move forward.

so some basics are:

export CFLAGS="-march=i486 -mtune=i686 -Os -pipe"
export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe"
export LDFLAGS="-Wl,-O1"

I won't show all my tczs loaded, as I may have more than I want but after my config

./configure --prefix=/usr/local --sysconfdir=/usr/local/etc --localstatedir=/var --disable-libusb --enable-dbus \
--with-fontpath=/usr/local/share/ghostscript/fonts --with-dbusdir=/usr/local/etc/dbus-1 --without-languages \
--enable-libpaper --enable-unit-tests --with-cups-user=tc --with-cups-group=lpadmin --with-languages=all \
--with-rcdir=/tmp/cupsinit --disable-gnutls --disable-openssl --enable-bannertops --enable-texttops \
--enable-pap --enable-tcp-wrappers --enable-acl  --enable-image   

Code: [Select]
cat *.log | grep error
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
conftest.c:10:28: fatal error: ac_nonexistent.h: No such file or directory
conftest.c:10:28: fatal error: ac_nonexistent.h: No such file or directory
g++: error: unrecognized option '-V'
g++: fatal error: no input files
| /* Override any GCC internal prototype to avoid an error.
conftest.c:60:21: fatal error: bstring.h: No such file or directory
conftest.c:27:21: fatal error: bstring.h: No such file or directory
conftest.c:60:21: fatal error: usersec.h: No such file or directory
conftest.c:27:21: fatal error: usersec.h: No such file or directory
conftest.c:62:23: fatal error: sys/ucred.h: No such file or directory
conftest.c:29:23: fatal error: sys/ucred.h: No such file or directory
| /* Override any GCC internal prototype to avoid an error.
| /* Override any GCC internal prototype to avoid an error.
| /* Override any GCC internal prototype to avoid an error.
conftest.c:54:11: error: 'struct stat' has no member named 'st_gen'
| /* Override any GCC internal prototype to avoid an error.
| /* Override any GCC internal prototype to avoid an error.
| /* Override any GCC internal prototype to avoid an error.
| /* Override any GCC internal prototype to avoid an error.
configure:13893: checking for library containing hstrerror
conftest.c:86:12: error: 'struct sockaddr' has no member named 'sa_len'
conftest.c:86:19: error: 'struct sockaddr' has no member named 'sa_len'
conftest.c:113:24: fatal error: sys/sockio.h: No such file or directory
conftest.c:80:24: fatal error: sys/sockio.h: No such file or directory
conftest.c:81:29: fatal error: netat/appletalk.h: No such file or directory
| /* Override any GCC internal prototype to avoid an error.
conftest.c:100:7: error: size of array 'off_t_is_large' is negative
conftest.c:130:20: fatal error: dns_sd.h: No such file or directory
conftest.c:97:20: fatal error: dns_sd.h: No such file or directory
| /* Override any GCC internal prototype to avoid an error.
conftest.c:130:20: fatal error: launch.h: No such file or directory
conftest.c:97:20: fatal error: launch.h: No such file or directory
ac_cv_search_hstrerror='none required'

Now lets try make -j3

Code: [Select]
root@box:/mnt/sda3/tczs/cups-1.4.8# make -j3
Using ARCHFLAGS=
Using ALL_CFLAGS=-I.. -D_CUPS_SOURCE -march=i486 -mtune=i686 -Os -pipe -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include   -DDBUS_API_SUBJECT_TO_CHANGE  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
Using ALL_CXXFLAGS=-I.. -D_CUPS_SOURCE -march=i486 -mtune=i686 -Os -pipe  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
Using CC=gcc
Using CXX=gcc
Using DSOFLAGS=-L../cups -Wl,-rpath,/usr/local/lib  -Wl,-soname,all -shared -Wall -Wno-format-y2k -fPIC -Os -g -fstack-protector -D_GNU_SOURCE
Using LDFLAGS=-L../cgi-bin -L../cups -L../filter -L../ppdc -L../scheduler -Wl,-O1 -Wl,-rpath,/usr/local/lib  -fPIE -pie -Wall -Wno-format-y2k -fPIC -Os -g -fstack-protector -D_GNU_SOURCE
Using LIBS=-lcups   -lpthread -lm -lcrypt
Making all in cups...
Making all in filter...
Linking gziptoany...
Linking testimage...
Making all in backend...
Linking parallel...
Linking snmp...
Linking usb...
libbackend.a(ieee1284.o): In function `backendGetMakeModel':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:356: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:366: undefined reference to `_cups_debug_puts'
libbackend.a(ieee1284.o): In function `backendGetDeviceID':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:60: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:72: undefined reference to `_cups_debug_puts'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:219: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:249: undefined reference to `_cups_debug_printf'
collect2: ld returned 1 exit status
make[1]: *** [parallel] Error 1
make[1]: *** Waiting for unfinished jobs....
libbackend.a(ieee1284.o): In function `backendGetMakeModel':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:356: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:366: undefined reference to `_cups_debug_puts'
libbackend.a(ieee1284.o): In function `backendGetDeviceID':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:60: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:72: undefined reference to `_cups_debug_puts'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:219: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:249: undefined reference to `_cups_debug_printf'
collect2: ld returned 1 exit status
make[1]: *** [snmp] Error 1
libbackend.a(ieee1284.o): In function `backendGetMakeModel':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:356: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:366: undefined reference to `_cups_debug_puts'
libbackend.a(ieee1284.o): In function `backendGetDeviceID':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:60: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:72: undefined reference to `_cups_debug_puts'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:219: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:249: undefined reference to `_cups_debug_printf'
collect2: ld returned 1 exit status
make[1]: *** [usb] Error 1
make: *** [all] Error 1

google suggests this link on possible collect2 ld error
http://stackoverflow.com/questions/4222501/how-to-solve-collect2-ld-returned-1-exit-status

Now here is where it gets ugly for me, maybe if I explain what I think I am doing you can reveal why I am wrong etc ok?

I can see that the static lib file libbackend.a seems to depend on ieee1284.o and so lets list the contents of the cups-src/backend folder
Quote
root@box:/mnt/sda3/tczs/cups-1.4.8# ls backend
Dependencies          http   libbackend.a  pap.c     scsi-irix.c   serial.o    socket      testbackend     usb-darwin.c
Makefile          ieee1284.c   lpd         parallel.c  scsi-linux.c   snmp-supplies.c  socket.c    testbackend.c   usb-libusb.c
backend-private.h       ieee1284.o   lpd.c         parallel.o  scsi.c   snmp-supplies.o  socket.o    testbackend.o   usb-unix.c
dnssd.c             ipp      lpd.o         runloop.c   scsi.o   snmp.c       test1284    testsupplies    usb.c
easysw-firewire-design.txt  ipp.c   network.c     runloop.o   serial   snmp.o       test1284.c  testsupplies.c  usb.o
easysw-firewire-linux.txt   ipp.o   network.o     scsi     serial.c   snmp.txt    test1284.o  testsupplies.o

so in my mind the first thing I think I need to do is redo the "c" file to generate the "object" file for  ieee1284

Code: [Select]
g++ backend/ieee1284.c -o backend/ieee1284.o
In file included from backend/ieee1284.c:28:0:
backend/backend-private.h:28:32: fatal error: cups/ppd-private.h: No such file or directory
compilation terminated

but appsearch for ppd-private.h.....no such file but that list contains a dependency list so here are the contents

Quote
# DO NOT DELETE THIS LINE -- make depend depends on it.

ipp.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/versioning.h
ipp.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h
ipp.o: ../cups/backend.h ../cups/sidechannel.h ../cups/ppd-private.h
ipp.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
ipp.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
ipp.o: ../cups/snmp-private.h ../cups/string.h
lpd.o: ../cups/http-private.h ../config.h ../cups/http.h ../cups/versioning.h
lpd.o: ../cups/md5.h ../cups/ipp-private.h ../cups/ipp.h backend-private.h
lpd.o: ../cups/backend.h ../cups/sidechannel.h ../cups/ppd-private.h
lpd.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
lpd.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
lpd.o: ../cups/snmp-private.h ../cups/string.h
dnssd.o: backend-private.h ../cups/backend.h ../cups/versioning.h
dnssd.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
dnssd.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
dnssd.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
dnssd.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
dnssd.o: ../config.h ../cups/array.h
pap.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
pap.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
pap.o: ../cups/language.h ../cups/backend.h ../cups/sidechannel.h
pap.o: ../cups/i18n.h ../cups/transcode.h
parallel.o: backend-private.h ../cups/backend.h ../cups/versioning.h
parallel.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
parallel.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
parallel.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
parallel.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
parallel.o: ../config.h
scsi.o: ../cups/backend.h ../cups/versioning.h ../cups/cups.h ../cups/ipp.h
scsi.o: ../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h
scsi.o: ../cups/language.h ../cups/i18n.h ../cups/transcode.h
scsi.o: ../cups/string.h ../config.h
serial.o: backend-private.h ../cups/backend.h ../cups/versioning.h
serial.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
serial.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
serial.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
serial.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
serial.o: ../config.h
snmp.o: backend-private.h ../cups/backend.h ../cups/versioning.h
snmp.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
snmp.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
snmp.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
snmp.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
snmp.o: ../config.h ../cups/array.h ../cups/file.h ../cups/http-private.h
snmp.o: ../cups/md5.h ../cups/ipp-private.h
socket.o: ../cups/http-private.h ../config.h ../cups/http.h
socket.o: ../cups/versioning.h ../cups/md5.h ../cups/ipp-private.h
socket.o: ../cups/ipp.h backend-private.h ../cups/backend.h
socket.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
socket.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
socket.o: ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
socket.o: ../cups/snmp-private.h ../cups/string.h
test1284.o: ../cups/string.h ../config.h ieee1284.c backend-private.h
test1284.o: ../cups/backend.h ../cups/versioning.h ../cups/sidechannel.h
test1284.o: ../cups/ppd-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
test1284.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
test1284.o: ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
test1284.o: ../cups/snmp-private.h
testbackend.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h
testbackend.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h
testbackend.o: ../cups/array.h ../cups/file.h ../cups/language.h
testbackend.o: ../cups/sidechannel.h
testsupplies.o: backend-private.h ../cups/backend.h ../cups/versioning.h
testsupplies.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
testsupplies.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
testsupplies.o: ../cups/file.h ../cups/language.h ../cups/debug.h
testsupplies.o: ../cups/i18n.h ../cups/transcode.h ../cups/snmp-private.h
testsupplies.o: ../cups/string.h ../config.h
usb.o: backend-private.h ../cups/backend.h ../cups/versioning.h
usb.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
usb.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
usb.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
usb.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
usb.o: ../config.h

At this point my with my skills  I am stumped!
« Last Edit: April 22, 2013, 09:40:49 PM by aus9 »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: collect2: ld returned 1 exit status
« Reply #1 on: March 30, 2013, 07:54:49 AM »
This is not the error you're interested in:
collect2: ld returned 1 exit status

It's this one:
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:249: undefined reference to `_cups_debug_printf'

It can't find the function. I'm not familiar with cups, but one quick workaround could be to disable parallel port support.
The only barriers that can stop you are the ones you create yourself.

aus9

  • Guest
Re: collect2: ld returned 1 exit status
« Reply #2 on: March 30, 2013, 09:16:22 AM »
well that causes me more issues unfortunately as above errors are

make[1]: *** [parallel] Error 1
make[1]: *** [snmp] Error 1
make[1]: *** [usb] Error 1

I am frightened if I disable these support I end up with no backends except maybe serial.

However I did run a new command which backs up what you said about parallel
Code: [Select]
make check
Using ARCHFLAGS=
Using ALL_CFLAGS=-I.. -D_CUPS_SOURCE -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include   -DDBUS_API_SUBJECT_TO_CHANGE -DDEBUG  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
Using ALL_CXXFLAGS=-I.. -D_CUPS_SOURCE -DDEBUG  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT
Using CC=gcc
Using CXX=gcc
Using DSOFLAGS=-L../cups -Wl,-rpath,/usr/local/lib  -Wl,-soname,all -shared -Wall -Wno-format-y2k -fPIC -Os -g -fstack-protector -D_GNU_SOURCE
Using LDFLAGS=-L../cgi-bin -L../cups -L../filter -L../ppdc -L../scheduler -Wl,-rpath,/usr/local/lib  -fPIE -pie -Wall -Wno-format-y2k -fPIC -Os -g -fstack-protector -D_GNU_SOURCE
Using LIBS=-lcups   -lpthread -lm -lcrypt
Making all in cups...
Making all in filter...
Making all in backend...
Linking parallel...
libbackend.a(ieee1284.o): In function `backendGetMakeModel':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:356: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:366: undefined reference to `_cups_debug_puts'
libbackend.a(ieee1284.o): In function `backendGetDeviceID':
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:60: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:72: undefined reference to `_cups_debug_puts'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:219: undefined reference to `_cups_debug_printf'
/home/tc/tczs/cups-1.4.8/backend/ieee1284.c:249: undefined reference to `_cups_debug_printf'
collect2: ld returned 1 exit status
make[1]: *** [parallel] Error 1
make: *** [all] Error 1

altho the snmp and usb are "not" showing up  here, it does confirm the first error is parallel.

What I think you are saying is .....don't try to re-code using g++ any c file but disable the support?

so I am still stumped.

aus9

  • Guest
Re: collect2: ld returned 1 exit status
« Reply #3 on: March 30, 2013, 09:29:43 AM »
ahh just found something.....something different is good

so pretend I ignored above advice and tried
Code: [Select]
root@box:/mnt/sda3/tczs/cups-1.4.8/backend# g++ parallel.c -o parallel.o
In file included from parallel.c:28:0:
backend-private.h:28:32: fatal error: cups/ppd-private.h: No such file or directory
compilation terminated.

now look at some dependencies for backend-private.h

#  include <cups/debug.h>

no such animal according to my eyesight in cups or its dev. Rich has given me appsearch to play with, and its search does not give a hit for cups*

ditto
i18n.h, snmp-private.h, and stop searching at this point.
« Last Edit: March 30, 2013, 09:32:49 AM by aus9 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11627
Re: collect2: ld returned 1 exit status
« Reply #4 on: March 30, 2013, 10:31:22 AM »
Hi aus9
Quote
i18n.h, snmp-private.h, and stop searching at this point.
glibmm-dev.tcz  contains  i18n.h

aus9

  • Guest
Re: collect2: ld returned 1 exit status
« Reply #5 on: March 30, 2013, 10:47:50 AM »
my bad I only meant for cups as per snippet

/*
 * Include necessary headers.
 */

#  include <cups/backend.h>
#  include <cups/sidechannel.h>
#  include <cups/ppd-private.h>
#  include <cups/debug.h>
#  include <cups/i18n.h>
#  include <cups/snmp-private.h>
#  include <stdlib.h>
#  include <errno.h>
#  include <cups/string.h>
#  include <signal.h>

I think I will close this thread....tomorrow morning.... as cups 1.4.8 does not appear to have the appropiate headers for what I was trying to do.