LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compiling files (https://www.linuxquestions.org/questions/linux-newbie-8/compiling-files-623112/)

tekmann33 02-22-2008 01:36 PM

Compiling files
 
I am trying to install an ASUS System Web-based Management tool on an ASUS Server and I am having trouble installing the rpm's.

The rpm files are on the System board CD. There are three of them:

Code:

aswm_core-2.0-312.el4rhat.x86_64.rpm
aswm_doc-2.0-9.noarch.rpm
aswm_rs163-e4_rx4-2.0-312.el4rhat.x86_64.rpm

When I install the first "core" rpm, I get this message:
Code:

[root@localhost x86_64]# rpm -ivh aswm_core-2.0-312.el4rhat.x86_64.rpm
Preparing...                ########################################### [100%]
  1:aswm_core              ########################################### [100%]
Warning: ASWM drivers doesn't support your running kernel 2.6.23.15-137.fc8
Please get the ASWM driver source code in /usr/aswm/lib/modules/src.
Untar and compile ghadrv,iodrv and laninfo for kernel 2.6.23.15-137.fc8.
Error, Can't find /etc/syslog.conf
Setting log file failed!
Please install the model RPM for running aswm.
[root@localhost x86_64]#

I then go to my /usr/aswm/lib/modules/src file and unpack and untar the indicated file and I see some directories as well as a macro makefile and version file:

Code:

[root@localhost src]# ls
drvsrc  drvsrc.tgz
[root@localhost src]# cd drvsrc
[root@localhost drvsrc]# ls
ghadrv  ghadrv_base  ghaipmi  iodrv  laninfo  macro  makefile  version
[root@localhost drvsrc]#

I go into the first directory and I see what looks like C code files:

Code:

[root@localhost drvsrc]# cd ghadrv
[root@localhost ghadrv]# ls
gha_common.o  ghadrv_kernel.c  ghaioctl.h  ghipmi_exp.h  load  Makefile  unload
[root@localhost ghadrv]#

What is the correct method to compile these files for the kernel? Would I use the gcc command? My experience with compiling code with Linux is by using the configure make and make install commands.

Any help would be appreciated.

osor 02-22-2008 01:56 PM

You most likely just have to type make, although that usually depends on your kernel-source symlink being setup correctly (/lib/modules/`uname -r`/build -> your_kernel_sourcedir).

tekmann33 02-22-2008 02:10 PM

When I execute the make command, I am not sure what this output is telling me:

Code:

[root@localhost ghadrv]# pwd
/usr/aswm/lib/modules/src/drvsrc/ghadrv
[root@localhost ghadrv]# ls
gha_common.o  ghadrv_kernel.c  ghaioctl.h  ghipmi_exp.h  load  Makefile  unload
[root@localhost ghadrv]# make
../iodrv/checkCompiler.mk:18: *** commands commence before first target.  Stop.
[root@localhost ghadrv]#

This is my kernel information:
Code:

[root@localhost ghadrv]# uname -r
2.6.23.15-137.fc8
[root@localhost ghadrv]#

My symlinks appear to be directed to the right kernel version:

Code:

[root@localhost 2.6.23.15-137.fc8]# pwd
/lib/modules/2.6.23.15-137.fc8
[root@localhost 2.6.23.15-137.fc8]# ls -l build
lrwxrwxrwx 1 root root 49 2008-02-21 20:15 build -> ../../../usr/src/kernels/2.6.23.15-137.fc8-x86_64
[root@localhost 2.6.23.15-137.fc8]#


osor 02-22-2008 03:07 PM

Quote:

Originally Posted by tekmann33 (Post 3066495)
Code:

[root@localhost ghadrv]# pwd
/usr/aswm/lib/modules/src/drvsrc/ghadrv
[root@localhost ghadrv]# ls
gha_common.o  ghadrv_kernel.c  ghaioctl.h  ghipmi_exp.h  load  Makefile  unload
[root@localhost ghadrv]# make
../iodrv/checkCompiler.mk:18: *** commands commence before first target.  Stop.
[root@localhost ghadrv]#


That’s odd. Perhaps you should try from the parent directory, and it will descend into each target. Are you sure that none of the files are executable? If it still doesn’t work, I suggest looking at iodrv/checkCompiler.mk (specifically around line 18) to see what the package creator was intending.

tekmann33 02-22-2008 03:47 PM

Quote:

Originally Posted by osor (Post 3066549)
That’s odd. Perhaps you should try from the parent directory, and it will descend into each target. Are you sure that none of the files are executable? If it still doesn’t work, I suggest looking at iodrv/checkCompiler.mk (specifically around line 18) to see what the package creator was intending.

When I execute the make command from the parent directory, I get the same message:
Code:

[root@localhost drvsrc]# pwd
/usr/aswm/lib/modules/src/drvsrc
[root@localhost drvsrc]# ls
ghadrv  ghadrv_base  ghaipmi  iodrv  laninfo  macro  makefile  version
[root@localhost drvsrc]# make
make  -C  iodrv
make[1]: Entering directory `/usr/aswm/lib/modules/src/drvsrc/iodrv'
checkCompiler.mk:18: *** commands commence before first target.  Stop.
make[1]: Leaving directory `/usr/aswm/lib/modules/src/drvsrc/iodrv'
make: *** [_all_iodrv] Error 2
[root@localhost drvsrc]#

Within each directory, there are two executables: load and unload:
Code:

[root@localhost ghadrv]# pwd
/usr/aswm/lib/modules/src/drvsrc/ghadrv
[root@localhost ghadrv]# ls -l
total 112
-rw-r--r-- 1 root root 44888 2006-12-13 22:34 gha_common.o
-rw-r--r-- 1 root root 17586 2006-05-19 02:08 ghadrv_kernel.c
-rw-r--r-- 1 root root  3895 2005-09-26 03:44 ghaioctl.h
-rw-r--r-- 1 root root  680 2003-11-05 04:34 ghipmi_exp.h
-rwxr-xr-x 1 root root  937 2006-02-20 03:09 load
-rw-r--r-- 1 root root  3699 2005-07-07 03:40 Makefile
-rwxr-xr-x 1 root root  197 2005-05-05 06:01 unload
[root@localhost ghadrv]#

When I execute the load command, I receive a message that a driver is missing:

Code:

[root@localhost ghadrv]# ./load
load driver : ./2.6.23.15-137.fc8/gha.o
Unable to load driver, can't find driver!

gha_common.o  ghadrv_kernel.c  ghaioctl.h  ghipmi_exp.h  load  Makefile  unload
[root@localhost ghadrv]#

The following is the from the file usr/aswm/lib/modules/src/drvsrc/iodrv\
checkCompiler.mk
Code:

1 # checkCompiler.mk
  2 # Dennis Yang
  3 # Include this for checking the compiler
  4 # Support RedHat, RHEL_AS_30, RHEL_AS_40, SUSE, SUEL_9
  5 # This .mk will parapre these parameters
  6 # $(CC) $(CPP)
  7 # Start: 2005/05/04
  8
  9 CC := gcc
 10 cc := $(shell which $(CC) > /dev/null 2>&1 && echo 1)
 11 ifeq (,$(cc))
 12        $(error Can not detect compiler $(CC))
 13 endif
 14
 15 CPP := g++
 16 cpp := $(shell which $(CPP) > /dev/null 2>&1 && echo 1)
 17 ifeq (,$(cpp))
 18        $(warning Can not detect compiler $(CPP))
 19 endif

I am not sure why it cannot see the compiler since I have the following installed:

Code:

[root@localhost iodrv]# rpm -qa | grep gcc
gcc-4.1.2-33
avr-gcc-c++-4.1.2-5.fc8
libgcc-4.1.2-33
libgcc-4.1.2-33
avr-gcc-4.1.2-5.fc8
[root@localhost iodrv]#


osor 02-22-2008 04:21 PM

Do you have both gcc and g++ installed? Do you have the which utility installed? Are both gcc and g++ in your PATH? If the answer to all of these questions is yes, you can safely replace checkCompiler.mk by the following two-line file:
Code:

CC  := gcc
CPP := g++

I personally don’t understand why it checks for g++ since I don’t see any C++ source files.

groenegrasmat 06-24-2008 10:31 AM

Just came across your post and saw that you have the same goal as I have, prop your gcc is fine so here is the first part of the solution;


Quote:

Originally Posted by tekmann33 (Post 3066582)
When I execute the make command from the parent directory, I get the same message:
Code:

[root@localhost drvsrc]# pwd
/usr/aswm/lib/modules/src/drvsrc
[root@localhost drvsrc]# ls
ghadrv  ghadrv_base  ghaipmi  iodrv  laninfo  macro  makefile  version
[root@localhost drvsrc]# make
make  -C  iodrv
make[1]: Entering directory `/usr/aswm/lib/modules/src/drvsrc/iodrv'
checkCompiler.mk:18: *** commands commence before first target.  Stop.
make[1]: Leaving directory `/usr/aswm/lib/modules/src/drvsrc/iodrv'
make: *** [_all_iodrv] Error 2
[root@localhost drvsrc]#

Within each directory, there are two executables: load and unload:
Code:

[root@localhost ghadrv]# pwd
/usr/aswm/lib/modules/src/drvsrc/ghadrv
[root@localhost ghadrv]# ls -l
total 112
-rw-r--r-- 1 root root 44888 2006-12-13 22:34 gha_common.o
-rw-r--r-- 1 root root 17586 2006-05-19 02:08 ghadrv_kernel.c
-rw-r--r-- 1 root root  3895 2005-09-26 03:44 ghaioctl.h
-rw-r--r-- 1 root root  680 2003-11-05 04:34 ghipmi_exp.h
-rwxr-xr-x 1 root root  937 2006-02-20 03:09 load
-rw-r--r-- 1 root root  3699 2005-07-07 03:40 Makefile
-rwxr-xr-x 1 root root  197 2005-05-05 06:01 unload
[root@localhost ghadrv]#

When I execute the load command, I receive a message that a driver is missing:

Code:

[root@localhost ghadrv]# ./load
load driver : ./2.6.23.15-137.fc8/gha.o
Unable to load driver, can't find driver!

gha_common.o  ghadrv_kernel.c  ghaioctl.h  ghipmi_exp.h  load  Makefile  unload
[root@localhost ghadrv]#

The following is the from the file usr/aswm/lib/modules/src/drvsrc/iodrv\
checkCompiler.mk
Code:

1 # checkCompiler.mk
  2 # Dennis Yang
  3 # Include this for checking the compiler
  4 # Support RedHat, RHEL_AS_30, RHEL_AS_40, SUSE, SUEL_9
  5 # This .mk will parapre these parameters
  6 # $(CC) $(CPP)
  7 # Start: 2005/05/04
  8
  9 CC := gcc
 10 cc := $(shell which $(CC) > /dev/null 2>&1 && echo 1)
 11 ifeq (,$(cc))
 12        $(error Can not detect compiler $(CC))
 13 endif
14
 15 CPP := g++
 16 cpp := $(shell which $(CPP) > /dev/null 2>&1 && echo 1)
 17 ifeq (,$(cpp))
 18        $(warning Can not detect compiler $(CPP))
 19 endif

I am not sure why it cannot see the compiler since I have the following installed:

Code:

[root@localhost iodrv]# rpm -qa | grep gcc
gcc-4.1.2-33
avr-gcc-c++-4.1.2-5.fc8
libgcc-4.1.2-33
libgcc-4.1.2-33
avr-gcc-4.1.2-5.fc8
[root@localhost iodrv]#


First red marked line means that you have [tabs] (before spitting output) in your script. Remove them (see 3rd red line). Now your script will run but will still stop with errors.

Second red line will not work, as the file ghaio.o is not yet generated.

The make command from the drvsrc directory will go to the appropriate directories and run the make command, during this process the *****.mod.o and the *****.o files are generated for your kernel version. After this process you will have a new directory in all the subdirs of drvsrc and will be able to load the files, but there is no need to do this manually.

This is where is goes wrong for me now. I get an error 126: cannot execute file. My rights are all as they should be but....

So far all the info that is usefull to you, if you get further then this please let me know.


All times are GMT -5. The time now is 11:44 AM.