Solved

smcinit make

Posted on 2006-11-24
31
878 Views
Last Modified: 2008-01-09
I downloaded this free (so far) bouquet of manure and have got most of the bugs fixed except one;

When I do a make I get an error of too few arguments to function 'pci_get_dev'

the line in questions is
dev = pci_get_dev(acc, BUS-LPC, LPC_DEV, LPC_FUNC);

I cannot find any .h file or anything on the web that gives me any hints on what arguments are missing.  

Please help I am almost there.  I really am hesitant to go to the freebee site since so far nothing they have has fixed what I have mitigated to this point.  It HAS been a challenge.

THx worth buku points to me
0
Comment
Question by:richgaz
  • 18
  • 13
31 Comments
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18011078
If you get this error, the compiler must have gotten a prototype for pci_get_dev from somewhere. You just have to find out where that somewhere is.
On my system, I found one in /usr/include:-
   ./pci/pci.h:121:struct pci_dev *pci_get_dev(struct pci_access *acc, int bus, int dev, int func); /* Raw access to specified device */
That one would seem to agree with the source line you provided. It's a part of the PCI Library: there's no such prototype in the Linux source tree.
Perhaps you have an old version of PCI Library?
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18011081
Or perhaps I have an old version - you never know
0
 

Author Comment

by:richgaz
ID: 18012883
Thx duncan I got the past that by simply adding another value of 0 in the second position. but now am in C coding where I really am an alien.  I now get implicit declaration of function for a slew of pci_ "types"  followed by assignment makes pointer from integer without cast.  What the hell does this mean?
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18012996
Adding 0 is not a fix, sorry. You must get the version of PCI library that the package was written to work with. Otherwise the header file will be wrong and you'll have all manner of trouble (as you are having). Looks like the package was written for an old version of the PCI lib where the function ony took 3 args, probably the first 3. The 4th arg is a function pointer which sounds like the one giving trouble from your description. What made you think the extra arg needed to go in the 2nd position? Post the failing source line if you like - as was originally. Possilbly adding NULL as the 4th arg instead will compile, but I don't fancy its chances of running.
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18013027
Ok the library comes from pci utils. The master site for this is ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/
I'm trolling through the old versions to find a match
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18013056
Oh yes, you posted the original line and it agreed with the prototype that I had. So I have a version of pci-utils that agrees with your code and you have a newer version that doesn't agree.
So far I have found that version 2.1.8 agrees. So you could get, build & install that, but maybe there's a newer one, see next post.
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18013074
It seems I have pciutils-2.1.11
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18013087
Yep, pciutils-2.2.0 has the new prototype:
struct pci_dev *pci_get_dev(struct pci_access *acc, int domain, int bus, int dev, int func); /* Raw access to specified device */
2.1.11 was the last 2.1. So if you get that, you should be in business
0
 

Author Comment

by:richgaz
ID: 18013905
okay I downloaded and used 2.1.8.of pciutil and that accpeted the pci_get_dev arument of 4.  BUt now I still get
linux:/tmp/smcinit-0.4-1 # make
gcc -c -pipe -Wall -W -O2   -o tosh1800-smcinit.o tosh1800-smcinit.c
gcc  -o tosh1800-smcinit tosh1800-smcinit.o
tosh1800-smcinit.o(.text+0x544): In function `main':
: undefined reference to `pci_alloc'
tosh1800-smcinit.o(.text+0x566): In function `main':
: undefined reference to `pci_filter_init'
tosh1800-smcinit.o(.text+0x57c): In function `main':
: undefined reference to `pci_init'
tosh1800-smcinit.o(.text+0x586): In function `main':
: undefined reference to `pci_scan_bus'
tosh1800-smcinit.o(.text+0x5ae): In function `main':
: undefined reference to `pci_filter_match'
tosh1800-smcinit.o(.text+0x611): In function `main':
: undefined reference to `pci_cleanup'
tosh1800-smcinit.o(.text+0x63a): In function `main':
: undefined reference to `pci_read_byte'
tosh1800-smcinit.o(.text+0x716): In function `main':
: undefined reference to `pci_read_byte'
tosh1800-smcinit.o(.text+0x730): In function `main':
: undefined reference to `pci_write_byte'
collect2: ld returned 1 exit status
make: *** [tosh1800-smcinit] Error 1


I have tried their smcinit and toch2450.c - this one seems to be the cleanest - any suggestions?   Like give it up?
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18014090
You need to add " -lpci" on the 2nd gcc line.
BTW I'd recommend 2.1.11 of pciutil
0
 

Author Comment

by:richgaz
ID: 18014637
When I add that command I get
usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/bin/ld: cannot find -lpci
collect2: ld returned 1 exit status
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18015186
At least you aren't picking up the old one. Did you actually build and install pciutil-2.1.x? (I still recommend you get 2.1.11) The library file libpci.a will be created. If you do a build and not an install, it will be in the source dir somewhere (use "locate libpci.a" to see where it is). You can tell gcc / ld to pick it up from there by adding " -L{dir containing libpci.a}" before " -lpci". The header (.h) file you were having trouble with is for the functions in this library
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18015188
If it's now in /usr/local/lib you still need -L/usr/local/lib
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18022392
Any progress?
0
 

Author Comment

by:richgaz
ID: 18026344
Right now in between my normal job I am trying to get clean complies of pciutil. I am now into ports.c after correcting filter.c access.c and dump.c.  Then I will be able to point to libpci.a.  I have no /usr/local on this linux SuSE R9.2 OS.  I do have a /usr/locale/lib.  Symantics I guess.  believe me I will let you know.  Your assistance has been greatly appreciated.  
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18026620
/usr/locale/lib? Sounds like something to do with internationalisation. Ah well...
0
 

Author Comment

by:richgaz
ID: 18033058
okay i got the pciutil installed and now with the make smcinit I get
gcc -c -pipe -Wall -W -O2                 -o tosh2450-smcinit.o tosh2450-smcinit.c
o tosh2450-smcinit tosh2450-smcinit.o  lspci
make: o: Command not found
make: [tosh2450-smcinit] Error 127 (ignored)
/usr/bin/install -c -p -D -m 755 -s  tosh2450-smcinit /usr/local/sbin/tosh2450-smcinit
/usr/bin/install: cannot stat `tosh2450-smcinit': No such file or directory
make: *** [install-bin] Error 1
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18035003
What happened to tosh1800? Looks like a garbled line in the Makefile - can you check that? As if "gcc -" had been chopped off the front and lspci appended instead of -lpci
0
 

Author Comment

by:richgaz
ID: 18035283
Here is the makefile - i chose 2450 over 1800 tosh cuz its a later model.   lspci IS the function added by pciutil.  





CC       = gcc
CFLAGS   = -pipe -Wall -W -O2
INCPATH  =
LIBS     = lspci
LIBS1    =
LIBS2    =
LIBS3    =
LINK     =
LFLAGS   =
INSTALL  = /usr/bin/install -c -p
INSTALL_PROGRAM = ${INSTALL} -D -m 755 -s
INSTALL_DATA    = ${INSTALL} -D -m 644
INSTALL_SCRIPT  = ${INSTALL}
INSTALL_HEADER  = $(INSTALL_DATA)
SOURCES1 = tosh2450-smcinit.c
SOURCES  = $(SOURCES1)
OBJECTS1 = $(SOURCES1:%.c=%.o)
OBJECTS  = $(OBJECTS1)
TARGETS1 = tosh2450-smcinit
TARGETS = $(TARGETS1)
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18035375
The LIBS line is wrong.
The posted Makefile is incomplete surely? There are no targets.
0
 

Author Comment

by:richgaz
ID: 18035769
all: $(TARGETS)

install: install-bin

uninstall: uninstall-man uninstall-bin


install-man:
        $(INSTALL_DATA) smcinit.8 $(INSTALL_ROOT)$(PREFIX)/share/man/man8/smcinit.8
        $(INSTALL_DATA) tosh1800-smcinit.8 $(INSTALL_ROOT)$(PREFIX)/share/man/man8/tosh1800-smc$

install-bin: all
        $(INSTALL_PROGRAM) $(TARGETS1) $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS1)
        $(INSTALL_PROGRAM) $(TARGETS2) $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS2)
        $(INSTALL_PROGRAM) $(TARGETS3) $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS3)


uninstall-man:
        rm -f $(INSTALL_ROOT)$(PREFIX)/share/man/man7/smcinit.7
        rm -f $(INSTALL_ROOT)$(PREFIX)/share/man/man8/smcinit.8
uninstall-bin:
        rm -f $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS1)
        rm -f $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS2)
        rm -f $(INSTALL_ROOT)$(PREFIX)/sbin/$(TARGETS3)

clean:
        rm -f $(OBJECTS) $(TARGETS)

%.o: %.c
        $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

config.h: config.h.in
        ./configure

$(SOURCES1): config.h

$(TARGETS1): $(OBJECTS1)
        $(LINK) $(LFLAGS) -o $(TARGETS1) $(OBJECTS1) $(LIBS1) $(LIBS)

What should the LIBS be that is the cmd that was added with pciutils
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18035934
LINK = gcc
LIBS = -lpci

or

LIBS = -L{dir where libpci.a is} -lpci
0
 

Author Comment

by:richgaz
ID: 18037883
linux:/tmp/smcinit-0.4-1 # make install
gcc -c -pipe -Wall -W -O2                 -o tosh2450-smcinit.o tosh2450-smcinit.c
gcc        -o tosh2450-smcinit tosh2450-smcinit.o  -L{/tmp/pciutils-2.1.8/lib} -lpci
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../../i586-suse-linux/bin/ld: cannot find -lpci
collect2: ld returned 1 exit status
make: *** [tosh2450-smcinit] Error 1
Duncan this is beginning to torque me - when I installed pciutil it installed lspci NOT lpci - is that cammnd the same?  And what is the purpose of ths lpci during link?
0
 

Author Comment

by:richgaz
ID: 18038599
OKay I can smell it now!!

Here is where I am now at with this  free source "crap"

inux:/tmp/smcinit-0.4-1 # make install
gcc -c -pipe -Wall -W -O2                 -o tosh2450-smcinit.o tosh2450-smcinit.c
gcc        -o tosh2450-smcinit tosh2450-smcinit.o /tmp/pciutils-2.1.8/lib/libpci.a
/usr/bin/install -c -p  -D -m 755 -s  tosh2450-smcinit /usr/local/sbin/tosh2450-smcinit
/usr/bin/install -c -p  -D -m 755 -s   /usr/local/sbin/
/usr/bin/install: too few arguments
Try `/usr/bin/install --help' for more information.
make: *** [install-bin] Error 1
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18040090
I didn't mean you to type the curly brackets! Would angle brackets have been any clearer? I'll keep using curlies - now you know.

gcc        -o tosh2450-smcinit tosh2450-smcinit.o  -L/tmp/pciutils-2.1.8/lib -lpci

lspci is a *command*. To load a library, the name of a library must start with "lib"  then you specify -l{rest of library name w/out .a}. Some libraries end .so instead of .a - they're shared libraries - anyway that's why you don't want the library suffix on the build command line.

There is no TARGETS2 or TARGETS3 so the install commands for these will fail. But TARGETS1 should have worked so you should be home:

/usr/bin/install -c -p  -D -m 755 -s  tosh2450-smcinit /usr/local/sbin/tosh2450-smcinit

as you posted has done the job.
0
 

Author Comment

by:richgaz
ID: 18043701
well my last hurdle is activating this - any pointers would be great
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 18044142
Either ensure /usr/local/sbin/ is in your PATH and then type "tosh2450-smcinit", or invoke it directly:
   /usr/local/sbin/tosh2450-smcinit
This will run the program. What will it do? - I have no idea. You could consult the man pages: "make install-man" may install them. Then type "man smcinit" or "man tosh1800-smcinit" (maybe tosh2450-smcinit).
Or cd to the source dir, look for files ending .8 or maybe .7 and man them directl;y ("man ./smcinit.8" &c).
0
 

Author Comment

by:richgaz
ID: 18044349
Duncan

If this does not pan out for me I must say you have been phenominal.  What I get is this (found no hits on google)
gaz@linux:/etc/init.d/rc5.d> /usr/local/sbin/tosh2450-smcinit
Trying method 1......using /proc/bus/pci...OK
Decided to use /proc/bus/pci
tosh2450-smcinit IO hub device 248c not supported.
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 18044470
This looks very much like the output from lspci with -G (debug) turned on. Except, lspci works (for me, at least). What did you expect from the utilities you are compiling? lspci is also free you know. Do have a look at the man pages as I posted earlier. Maybe try lspci -n to see if it shows the mysterious 248c somewhere. E.g. on my system:

22:42:04$ lspci -G -n
Trying method 1......using /proc/bus/pci...OK
Decided to use /proc/bus/pci
00:00.0 Class 0600: 1106:3188 (rev 01)
00:01.0 Class 0604: 1106:b188
00:06.0 Class 0200: 10b7:9058
00:08.0 Class 0100: 9004:8178 (rev 01)
00:0b.0 Class 0200: 14e4:1653 (rev 03)
00:0f.0 Class 0104: 1106:3149 (rev 80)
00:0f.1 Class 0101: 1106:0571 (rev 06)
00:10.0 Class 0c03: 1106:3038 (rev 81)
00:10.1 Class 0c03: 1106:3038 (rev 81)
00:10.2 Class 0c03: 1106:3038 (rev 81)
00:10.4 Class 0c03: 1106:3104 (rev 86)
00:11.0 Class 0601: 1106:3227
00:11.5 Class 0401: 1106:3059 (rev 60)
00:18.0 Class 0600: 1022:1100
00:18.1 Class 0600: 1022:1101
00:18.2 Class 0600: 1022:1102
00:18.3 Class 0600: 1022:1103
00:19.0 Class 0600: 1022:1100
00:19.1 Class 0600: 1022:1101
00:19.2 Class 0600: 1022:1102
00:19.3 Class 0600: 1022:1103
01:00.0 Class 0300: 1002:5159
0
 

Author Comment

by:richgaz
ID: 18046210
I found earlier a doc which described changes to smcinit.c I made them but currently at work so I will not be able to test them until later.  

Thx Duncan - You canclose this and acceptm the points.  Yeoman effort again thx.
0
 

Author Comment

by:richgaz
ID: 18046221
If this doesn;t work well time to get a Cicsco wireless plugin card.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now