ID |
Date |
Author |
Topic |
Subject![down down](down.png) |
680
|
27 Nov 2009 |
Stefan Ritt | Bug Report | "mserver -s" is broken | > I notice that "mserver -s" (a non-default mode of operation) does not work right
> - if I connect odbedit for the first time, all is okey, if I connect the second
> time, mserver crashes - because after the first connection closed,
> rpc_deregister_functions() was called, rpc_list is deleted and causes a crash
> later on. Because everybody uses the default "mserver -m" mode, I am not sure
> how important it is to fix this.
> K.O.
"mserver -s" is there for historical reasons and for debugging. I started originally
with a single process server back in the 90's, and only afterwards developed the multi
process scheme. The single process server now only works for one connection and then
crashes, as you described. But it can be used for debugging any server connection,
since you don't have to follow the creation of a subprocess with your debugger, and
therefore it's much easier. But after the first connection has been closed, you have
to restart that single server process. Maybe one could add some warning about that, or
even fix it, but it's nowhere used in production mode. |
681
|
27 Nov 2009 |
Konstantin Olchanski | Bug Report | "mserver -s" is broken | >
> "mserver -s" is there for historical reasons and for debugging.
>
I confirm that my modification also works for "mserver -s". I also added an assert() to the
place in midas.c were it eventually crashes, to make it more obvious for the next guys.
K.O. |
229
|
17 Oct 2005 |
Exaos Lee | Bug Fix | "make install" error under MacOS X | Under MacOS X, "make install" will cours an error like this:
...
install: darwin/bin/dio: No such file or directory
make: *** [install] Error 71
This can be fixed as the following diff:
404,405c404,405
< $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c
< $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c $(LIB) $(LIBS)
---
> $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c
> $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c $(LIB) $(LIBS)
438c438,439
< @for i in mserver mhttpd odbedit mlogger ; \
---
>
> @for i in mserver mhttpd odbedit mlogger dio ; \
444,447d444
< chmod +s $(SYSBIN_DIR)/mhttpd
<
< ifeq ($(OSTYPE),linux)
< install -v -m 755 $(BIN_DIR)/dio $(SYSBIN_DIR)
449c446
< endif
---
> chmod +s $(SYSBIN_DIR)/mhttpd
|
312
|
16 Oct 2006 |
Exaos Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
problem of "Makefile". I did some change to it and attach the diff file here. |
Attachment 1: Makefile.diff
|
461,463c461,463
< chmod +s $(SYSBIN_DIR)/dio
< chmod +s $(SYSBIN_DIR)/mhttpd
< chmod +s $(SYSBIN_DIR)/webpaw
---
> if [ -f $(SYSBIN_DIR)/dio ]; then chmod +s $(SYSBIN_DIR)/dio ; fi
> if [ -f $(SYSBIN_DIR)/mhttpd ]; then chmod +s $(SYSBIN_DIR)/mhttpd; fi
> if [ -f $(SYSBIN_DIR)/webpaw ]; then chmod +s $(SYSBIN_DIR)/webpaw; fi
521c521
< @for i in mserver mhttpd dio ; \
---
> @for i in mserver mhttpd; \
525a526,528
> ifeq ($(OSTYPE),linux)
> install -v -m 755 $(BIN_DIR)/dio $(SYSBIN_DIR)
> endif
527,528c530,531
< chmod +s $(SYSBIN_DIR)/dio
< chmod +s $(SYSBIN_DIR)/mhttpd
---
> if [ -f $(SYSBIN_DIR)/dio ]; then chmod +s $(SYSBIN_DIR)/dio; fi
> if [ -f $(SYSBIN_DIR)/mhttpd ]; then chmod +s $(SYSBIN_DIR)/mhttpd; fi
|
313
|
16 Oct 2006 |
Stefan Ritt | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | > While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
> problem of "Makefile". I did some change to it and attach the diff file here.
I committed your patch. Thank you. |
437
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | > While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
> problem of "Makefile". I did some change to it and attach the diff file here.
Thank you very much for your instructions for installing Midas on MacOSX.
I followed your instructions to change the Makefile but I still get the following error message:
...
... Installing programs and utilities to /usr/local/bin
...
install: darwin/bin/lazylogger exists but is not a directory
install: darwin/bin/mchart exists but is not a directory
install: darwin/bin/mcnaf exists but is not a directory
install: darwin/bin/mdump exists but is not a directory
install: darwin/bin/melog exists but is not a directory
install: darwin/bin/mhdump exists but is not a directory
install: darwin/bin/mhist exists but is not a directory
install: darwin/bin/mhttpd exists but is not a directory
install: darwin/bin/mlogger exists but is not a directory
install: darwin/bin/mlxspeaker exists but is not a directory
install: darwin/bin/mserver exists but is not a directory
install: darwin/bin/mstat exists but is not a directory
install: darwin/bin/mtape exists but is not a directory
install: darwin/bin/odbedit exists but is not a directory
install: darwin/bin/odbhist exists but is not a directory
install: darwin/bin/stripchart.tcl exists but is not a directory
install: darwin/bin/webpaw exists but is not a directory
make: *** [install] Error 71
Could you help me solve this problem? Thank you in advance =) |
438
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | I forgot to mention that, the following (and similar) lines:
install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
are changed into
install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
> > While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the
> > problem of "Makefile". I did some change to it and attach the diff file here.
>
> Thank you very much for your instructions for installing Midas on MacOSX.
> I followed your instructions to change the Makefile but I still get the following error message:
>
> ...
> ... Installing programs and utilities to /usr/local/bin
> ...
> install: darwin/bin/lazylogger exists but is not a directory
> install: darwin/bin/mchart exists but is not a directory
> install: darwin/bin/mcnaf exists but is not a directory
> install: darwin/bin/mdump exists but is not a directory
> install: darwin/bin/melog exists but is not a directory
> install: darwin/bin/mhdump exists but is not a directory
> install: darwin/bin/mhist exists but is not a directory
> install: darwin/bin/mhttpd exists but is not a directory
> install: darwin/bin/mlogger exists but is not a directory
> install: darwin/bin/mlxspeaker exists but is not a directory
> install: darwin/bin/mserver exists but is not a directory
> install: darwin/bin/mstat exists but is not a directory
> install: darwin/bin/mtape exists but is not a directory
> install: darwin/bin/odbedit exists but is not a directory
> install: darwin/bin/odbhist exists but is not a directory
> install: darwin/bin/stripchart.tcl exists but is not a directory
> install: darwin/bin/webpaw exists but is not a directory
> make: *** [install] Error 71
>
> Could you help me solve this problem? Thank you in advance =) |
439
|
19 Feb 2008 |
Stefan Ritt | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | > I forgot to mention that, the following (and similar) lines:
> install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> are changed into
> install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
>
> since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
-D under linux means:
-D create all leading components of DEST except the last, then
copy SOURCE to DEST; useful in the 1st format
This means if you install the first time, and eithe SYSBIN_DIR or `basename is not existing, it will be created on-the-fly from
the install program. If OSX does not support this, you somehow have to crate these subdirectories manually. |
441
|
19 Feb 2008 |
Maggie Lee | Bug Fix | "make install" error on MacOS 10.4.7, svn 3366 | Thank you for your help =)
Since SYSBIN_DIR is defined as /usr/local/bin in the Makefile and it exists in my computer, so I deleted the -D in the Makefile and tried to "make install" again and the
error message becomes:
...
... Installing programs and utilities to /usr/local/bin
...
/bin/sh: -c: line 2: syntax error: unexpected end of file
make: *** [install] Error 2
Can anyone help me solve this problem?
> > I forgot to mention that, the following (and similar) lines:
> > install -v -D -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> > are changed into
> > install -v -d -m 755 $$file $(SYSBIN_DIR)/`basename $$file` ; \
> >
> > since -D is an illegal option for install. I am not sure whether -D in Linux means the same thing for -d in MacOSX install.
>
> -D under linux means:
>
> -D create all leading components of DEST except the last, then
> copy SOURCE to DEST; useful in the 1st format
>
> This means if you install the first time, and eithe SYSBIN_DIR or `basename is not existing, it will be created on-the-fly from
> the install program. If OSX does not support this, you somehow have to crate these subdirectories manually. |
294
|
17 Aug 2006 |
Konstantin Olchanski | Bug Report | "double" values are truncated | The mhttpd ODB displays and mhist truncate values of "float" and "double"
floating point variables to 6 digits. In reality, "float" has 7 significant
digits and "double" has 16. I recommend that db_sprintf() in odb.c be changed to
read this:
case TID_FLOAT:
sprintf(string, "%.7g", *(((float *) data) + index));
break;
case TID_DOUBLE:
sprintf(string, "%.16g", *(((double *) data) + index));
break;
K.O. |
295
|
17 Aug 2006 |
Stefan Ritt | Bug Report | "double" values are truncated | > The mhttpd ODB displays and mhist truncate values of "float" and "double"
> floating point variables to 6 digits. In reality, "float" has 7 significant
> digits and "double" has 16. I recommend that db_sprintf() in odb.c be changed to
> read this:
>
> case TID_FLOAT:
> sprintf(string, "%.7g", *(((float *) data) + index));
> break;
> case TID_DOUBLE:
> sprintf(string, "%.16g", *(((double *) data) + index));
> break;
>
> K.O.
I had there
case TID_FLOAT:
if (ss_isnan(*(((float *) data) + index)))
sprintf(string, "NAN");
else
sprintf(string, "%g", *(((float *) data) + index));
break;
case TID_DOUBLE:
if (ss_isnan(*(((double *) data) + index)))
sprintf(string, "NAN");
else
sprintf(string, "%lg", *(((double *) data) + index));
break;
so I assumed that "%g" takes care of the maximal resolution. But apparently it does
not. So I changed it as you proposed. |
186
|
16 Dec 2004 |
Konstantin Olchanski | Info | "cd /" in ss_daemon_init(), was- Commit local TWIST modifications | > > - system.c: do not chdir("/") in ss_daemon_init()- it prevents us from ever
> > getting core dumps from midas daemons.
>
> The chdir("/") is from one of the unix text books. They say you HAVE to do it. If you start a
> daemon on an NFS file system, you cannot unmount that file system as long as the daemon is
> running.
Right, I remember this NFS problem from a while back.
This problem does not exist in the current crop of Linux systems (since Red Hat 7.3 at least) - they
either kill off all user programs or use "umount -f" and "umount -l".
"umount -l" works in any case to unmount a "busy" filesystem.
For systems where the NFS problem does still exist, one should do this: "mlogger -D" becomes "(cd /; mlogger -D)".
So I suspect that the "cd /" advice from the unix programming book is no longer as necessary
as it used to be. (Perhaps a better advice would have been to "cd /tmp", so we could still get
core dumps from non-root daemons).
K.O. |
834
|
06 Sep 2012 |
shaun | Bug Report | "cannot find recent history file" | Hi, when attempting to access a history window the following message is repeated
over and over in the MIDAS message log:
Thu Sep 6 11:37:16 2012 [mhttpd,ERROR] [history.c:886:hs_count_events,ERROR]
cannot find recent history file
Thu Sep 6 11:38:16 2012 [mhttpd,ERROR] [history.c:886:hs_count_events,ERROR]
cannot find recent history file
Thu Sep 6 11:38:16 2012 [mhttpd,ERROR] [history.c:886:hs_count_events,ERROR]
cannot find recent history file
Thu Sep 6 11:39:16 2012 [mhttpd,ERROR] [history.c:886:hs_count_events,ERROR]
cannot find recent history file
Thu Sep 6 11:39:16 2012 [mhttpd,ERROR] [history.c:886:hs_count_events,ERROR]
cannot find recent history file
It appears to be related to attempting to display a history graph that includes
some time periods that have no recorded history data. When I zoom in so that the
whole graph has data the error message goes away.
The graph displays fine either way, so this error message seems useless. Is
there a way to suppress it?
Thanks
Shaun |
2453
|
31 Jan 2023 |
Lukas Gerritzen | Suggestion | "Soft interlock" possible? | Is it possible to impose requirements on certain output variables in an interlock-like fashion? For example: "As long as the temperature exceeds a certain threshold, a light switched by a relay cannot be turned on."
A workaround would be to set an alarm on that variable and call a script which turns the light back off, but that might not be ideal in certain scenarios. For safety-critical situations, a PLC would be preferred, but I am missing an option between those two. |
2454
|
31 Jan 2023 |
Stefan Ritt | Suggestion | "Soft interlock" possible? | > Is it possible to impose requirements on certain output variables in an interlock-like fashion? For example: "As long as the temperature exceeds a certain threshold, a light switched by a relay cannot be turned on."
>
> A workaround would be to set an alarm on that variable and call a script which turns the light back off, but that might not be ideal in certain scenarios. For safety-critical situations, a PLC would be preferred, but I am missing an option between those two.
No, interlocks of that kind are not implemented in midas. And that is for a good reason. Interlocks are critical, so one must be sure 100% that they are working. This cannot be done with complex software such as midas. You have to use dedicated hardware for that.
Most people use a PLC controller which is made for that. Midas is then only used to read and display the status of the interlock controller.
Stefan |
489
|
16 Jun 2008 |
Stefan Ritt | Bug Fix | "Missing event" problem fixed in front-end framework | Since the very beginning midas had the problem that the last event of a run was
sometimes missing in the data. While for most experiments this is not an issue,
it starts to hurt on experiments using event building (front-end 1 and front-end
2 in the example below). A missing event can screw up the event builder on the
next begin of run, where the "missing event" would show up as the first event of
the new run, triggering an event mismatch error in the event builder.
After some analysis, we identified the problem as follows. Assume FE1 controls
the trigger, while FE2 generates the second event fragment.
1) Stop is requested to FE1
2) tr_stop gets called on FE1
3) tr_stop calls end_of_run() use code
4) end_of_run() disables the trigger
5) FE1 finishes stop transition
6) Stop is requested to FE2
7) FE2 finishes stop transition
What can now happen is the following: An additional event occurs between 2) and
4). This event triggers ADCs and TDCs, and is then stored in the front-end
hardware. FE2 sees this event, since it has not yet done the stop transition,
and reads it out. FE1 is however already in the end_of_run() routine, and simply
disables the trigger, without reading this last event, and thus causing the
event mismatch at the beginning of the next run.
To fix the problem, the framework in mfe.c was changed:
1) Stop is requested to FE1
2) tr_stop gets called on FE1
3) tr_stop calls end_of_run() use code
4) end_of_run() disables the trigger
4b) tr_stop calls check_polled_events()
5) FE1 finishes stop transition
6) Stop is requested to FE2
7) FE2 finishes stop transition
The new routine check_polled_events checks if there is any more event in the
hardware by calling the user polling routine. If there is one more event, calls
the user readout routine and sends it to the back-end before concluding the run
transition.
This modification solved our problem at the MEG experiment at PSI, but it might
be good that all experiments using event building update midas to revision 4225.
I do not expect any bad side effect, but one never knows. So if there are new
problems caused by this modification, please report.
- Stefan |
466
|
10 Mar 2008 |
Exaos Lee | Suggestion | "Makefile-by-EL" updated | > Not that the current Makefile is too pretty (I have seen worse), but it
works and it is fairly compact for a project of
> this complexity, it handles a large number of operating systems and build
options very efficiently.
>
> I think you found that out with your rewriting exercise - your version of
the Makefile contains all the same code,
> just rearranged to suite your taste, with existing bugs preserved and new
bugs added.
I derived the new Makefile from the original one so that feathers and bugs are
also included.
I havn't experiences on platforms other than Linux and MacOS, so I cannot
recognize bugs on
other platforms if they exists in the original one. And if there are bugs,
hope users can figure
them out.
>
> As they say, the devil is in the details. I notice some subtle changes in
your Makefile that make me go "what?":
>
> 1) the command for building the midas shared library used to be "ld -
shared", in your version, "-shared" is gone.
> But check with the GCC manual, today's recommended command is probably "gcc -
shared".
Fixed.
> 2) mhdump is now linked with ROOT, but I wrote it recently enough to
remember that it does not use ROOT
The building dependence on ROOT of mhdump may be eliminated by changing the
specific target.
> 3) hand-crafted dependancies have been replaced with generic "almost
every .o depends on every .h", which is
> incorrect. The "almost every .o" part bothers me.
Fixed now.
> 4) "make clean" runs "rm -rf" - plain scary.
Fixed.
> 5) "$(shell ...)" is overused
Replaced with GNU make internal methods.
> I think by the end all these little details are sorted out and all the
quirks are put back in, your Makefile will look no
> better than the current Makefile.
I realized it now. But anyway, it looks tidy to me now. I still hope to use
AUTOTOOLS with MIDAS.
> > 2. The file is less than 400 lines now. The original one is more than 500
lines.
The new one is about 430 lines. Hmmm, it reaches the original one which is
more than 600 lines.
>
> It looks like your savings came from removing comments, removing hand-
crafted dependancy lists and replacing
> fairly verbose "make install" targets (which we do not use anyway) with your
own much simpler scripts.
>
> All the juicy bits needed to actually build all the code appear to take
about as much space as before.
>
> Also the original mistake of recompiling programs when they only need
relinking was not fixed. (For example,
> when libmidas is updated, to update mhttpd, the current Makefile needlessly
recompiles mhttpd.c. Better use
> would be to compile mhttpd.c into mhttpd.o, then only a relink is needed).
Fixed.
>
> Most experience with autoconf/automake is all negative. The promise
was "never debug your Makefile ever
> again!", delivered was "debug the configure script instead!". In practice,
with autoconf/automake, you try to run
> configure, kludge it until it stops crashing, then tweak the
incomprehensible Makefiles it produces until the code
> compiles.
>
> K.O.
====================================================
Maybe BUGS or FEATURES in this new one:
1. The shared libmidas.so and the static libmidas.a are built sperately.
The "libmidas.a" is
always built whether "NEED_SHLIB" is set or not. And all executables are built
staticly default.
I commented this in the Makefile-by-EL. Hence, if you want to use libmidas.so
with PyMIDAS and
do not want to encounter "Segmentation fault" while executing the utilies
linked dynamicly, you
may try this one.
2. I found that "minife" is failed to be built, so I remove it from the
example list.
3. Some bugs while building on MacOS Tiger 10.4.11 PPC are commented out in
the Makefile. These
bugs are still exists in the original one.
4. Using "VPATH" instead of adding pathnames.
5. Using "UTILS_SUID" to handle utilities which need SUID mode. And
the "UTILS_SUID_NEED" may be
defined in the OS-specific field, so you need not to use OS-specific commands
in the "install"
target.
6. Using "tr" with "uname" in order to delete some extra "ifeq
($(OSTYPE),...)".
7. Other things, please see the file.
Anyway, easier building is my purpose. :-) |
Attachment 1: Makefile-by-EL
|
#-include MIDAS-env.mk --- split the environment setup in a seperate file?
# initialized flags
#CC = icc
#FC = ifort
#LD = ld
CFLAGS = -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB
###########################################################################
## Environments setup for building MIDAS/PSI
## Prefix
ifndef PREFIX
PREFIX = /usr/local
endif
# User defined flags for compiler
USERFLAGS =
# Do you need to compile the shared library? If so, set "1" here.
NEED_SHLIB =
# If RPATH needed ...
NEED_RPATH =
# If static ROOT libaries needed ...
NEED_LIBROOTA =
# If strlcpy.o needed ...
NEED_STRLCPY = 1
# If zlib needed ...
NEED_ZLIB = 1
# MIDAS max event size
MIDAS_MAX_EVENT_SIZE =
# OS specific programs included
SPECIFIC_OS_PRG =
# ..? Why it is needed?
MIDAS_PREF_FLAGS =
# Build examples or not? If so, set "1" here ...
EXAMPLES_NEED = 1
## installer
INSTALL = $(shell which install)
# **** CAUTION ****
# **** On MacOS Tiger, "/usr/bin/install" doesn't accept "-D" option!
# **** NEED to be fixed ...
ifndef INSTALL
INSTALL = ./install.sh
else
INS_OPTS = -v -D
endif
# MXML dir
ifndef MXML_DIR
MXML_DIR = ../mxml
endif
# MySQL
# **** CAUTION ****
# **** On MacOS Tiger (10.4.11), the "MYSQL_CONFIG" will be always defined because
# **** "which" will always return something whether it finds the exec or not!
# **** NEED to be fixed!
MYSQL_CONFIG := $(shell which mysql_config 2> /dev/null)
ifdef MYSQL_CONFIG
MYSQLINCDIR := $(shell mysql_config --cflags | sed -e 's,^.*-I\([^ ]*\).*$$,\1,' -e s/\'//g)
NEED_MYSQL := $(shell if test -e $(MYSQLINCDIR)/mysql.h ; then echo 1; fi)
endif
###########################################################################
## Check OS Type for OS-specified flags
# *** CAUTION *** Does "tr" exist on all POSIX platform?
OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]')
ifeq ($(OSTYPE), linux)
# > 2GB file support
CFLAGS += -D_LARGEFILE64_SOURCE
CFLAGS += -DOS_LINUX -fPIC -Wno-unused-function
LDFLAGS += -lutil -lpthread
NEED_ZLIB = 1
SPECIFIC_OS_PRG += mlxspeaker dio
endif
ifeq ($(OSTYPE), osf1)
CFLAGS += -DOS_OSF1
FFLAGS += -nofor_main -D 40000000 -T 20000000
LDFLAGS += -lc -lbsd
endif
ifeq ($(OSTYPE), ultrix)
CFLAGS += -DOS_ULTRIX -DNO_PTY
endif
ifeq ($(OSTYPE), freebsd)
CFLAGS += -DOS_FREEBSD
LDFLAGS += -lbsd -lcompat
endif
ifeq ($(OSTYPE), darwin)
CFLAGS += -DOS_LINUX -DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function
LDFLAGS += -lpthread
NEED_RANLIB = 1
SPECIFIC_OS_PRG += mlxspeaker
endif
ifeq ($(OSTYPE), cygwin_nt-5.1)
OSTYPE = cygwin
endif
ifeq ($(OSTYPE), cygwin)
CFLAGS += -DOS_LINUX -DOS_CYGWIN -Wno-unused-function
LDFLAGS += -lutil -lpthread
endif
ifeq ($(OSTYPE), solaris)
CFLAGS += -DOS_SOLARIS
LDFLAGS += -lsocket -lnsl
endif
###########################################################################
## Processing environment for building flags
CFLAGS += $(MIDAS_PREF_FLAGS) $(USERFLAGS)
ifdef MIDAS_MAX_EVENT_SIZE
CFLAGS += -DMAX_EVENT_SIZE=$(MIDAS_MAX_EVENT_SIZE)
endif # MIDAS_MAX_EVENT_SIZE
ifdef NEED_MYSQL
CFLAGS += -DHAVE_MYSQL $(shell $(MYSQL_CONFIG) --include)
LDFLAGS += $(shell $(MYSQL_CONFIG) --libs)
NEED_ZLIB = 1
endif # NEED_MYSQL
ifdef ROOTSYS
ROOTLIBS := $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTCFLAGS := $(shell $(ROOTSYS)/bin/root-config --cflags)
ifdef NEED_RPATH
ROOTLIBS += -Wl,-rpath,$(ROOTSYS)/lib
endif
ifdef NEED_LIBROOTA
ROOTLIBS := $(ROOTSYS)/lib/libRoot.a -lssl -ldl -lcrypt
endif
CFLAGS += $(ROOTCFLAGS)
endif # ROOTSYS
ifdef NEED_ZLIB
CFLAGS += -DHAVE_ZLIB
LDFLAGS += -lz
endif # ZLIB
###########################################################################
## Processing building targets
## Directories needed
INC_DIR = include
SRC_DIR = src
UTL_DIR = utils
DRV_DIR = drivers
EXM_DIR = examples
## Driectories which will be created
OS_DIR = $(OSTYPE)
LIB_DIR = $(OS_DIR)/lib
BIN_DIR = $(OS_DIR)/bin
DIRS = $(OS_DIR) $(LIB_DIR) $(BIN_DIR)
CFLAGS += -I$(INC_DIR) -I$(DRV_DIR) -I$(MXML_DIR)
## Directories for install
INSTDIR_BIN = $(PREFIX)/bin
INSTDIR_INC = $(PREFIX)/include
INSTDIR_LIB = $(PREFIX)/lib
INSTDIR_DRV = $(PREFIX)/driver
## Utilities
UTILS = mserver mhttpd mlogger odbedit mtape mhist \
mstat mcnaf mdump mhdump mchart odbhist \
melog webpaw lazylogger stripchart.tcl \
$(SPECIFIC_OS_PRG)
# Utilities need to change SUID mode
UTILS_SUID_NEED = dio mhttpd webpaw
UTILS_SUID = $(UTILS_SUID_NEED:%=$(BIN_DIR)/%)
## Analyzer objects
ANALYZER = $(LIB_DIR)/mana.o
ifdef CERNLIB
ANALYZER += $(LIB_DIR)/hmana.o
endif
ifdef ROOTSYS
ANALYZER += $(LIB_DIR)/rmana.o
endif
## Objects for building $(LIBMIDAS_A) and $(LIBMIDAS_SO)
OBJS4LIB_ALL = midas.o system.o mrpc.o odb.o ybos.o ftplib.o history.o alarm.o elog.o
OBJS4LIB_A = $(OBJS4LIB_ALL:%=$(LIB_DIR)/%) $(LIB_DIR)/cnaf_callback.o
OBJS4LIB_SO = $(OBJS4LIB_ALL:%=$(LIB_DIR)/%)
## MXML OBJS
MXML_OBJS_NEED = mxml.o
ifdef NEED_STRLCPY
MXML_OBJS_NEED += strlcpy.o
endif
MXML_OBJS = $(MXML_OBJS_NEED:%=$(LIB_DIR)/%)
## Objects for install
OBJS_INS_NEED = mfe.o fal.o
OBJS_INS = $(OBJS_INS_NEED:%=$(LIB_DIR)/%)
## library
LIBMIDAS_A = $(LIB_DIR)/libmidas.a
ifdef NEED_SHLIB
LIBMIDAS_SO = $(LIB_DIR)/libmidas.so
CFLAGS += -shared -fPIC
LDFLAGS += -shared
# if need to link utilities dynamically with libmidas.so, add this flag...
LDFLAGS_SH += -shared -L$(LIB_DIR) -lmidas
endif # NEED_SHLIB
## Examples
EXAMPLES = consume produce rpc_test msgdump minirc odb_test #minife - failed building!
## All executables
EXECS = $(UTILS:%=$(BIN_DIR)/%)
ifdef EXAMPLES_NEED
EXECS += $(EXAMPLES:%/$(BIN_DIR)/%)
endif
###########################################################################
CXXFLAGS = $(CFLAGS)
ifdef ROOTSYS
CXXFLAGS += -DHAVE_ROOT
endif
all: check-mxml $(DIRS) $(LIBMIDAS_A) $(LIBMIDAS_SO) \
$(ANALYZER) $(OBJS_INS) $(EXECS)
.PHONY: clean
examples: $(LIBMIDAS_A) $(EXAMPLES:%=$(BIN_DIR)/%)
## Static
static:
@rm -f $(EXECS)
@$(MAKE) USERFLAGS=-static
## Install
install: install-utils install-includes install-libs \
install-drivers install-src install-examples
@echo "..."
@echo "... Happy working with MIDAS! "
@echo "..."
###########################################################################
$(DIRS):
@echo "Making directory $@ ..."
@mkdir -p $@
## Libraries
$(LIBMIDAS_A): $(OBJS4LIB_A) $(MXML_OBJS)
@rm -f $@
@echo "Creating $@ ..."
@ar -crv $@ $^
ifdef NEED_RANLIB
@ranlib $@
endif
$(LIBMIDAS_SO): $(OBJS4LIB_SO) $(MXML_OBJS)
@rm -f $@
@echo "Creating $@ ..."
@$(CC) $(LDFLAGS) -o $@ $^
## MXML-check
check-mxml:
ifdef NEED_STRLCPY
@if test ! -e $(MXML_DIR)/strlcpy.h ; then \
echo "Please download mxml from: " ; \
echo "http://midas.psi.ch/htmldoc/quickstart.html" ;\
exit 1; \
fi
... 135 more lines ...
|
467
|
10 Mar 2008 |
Exaos Lee | Suggestion | "Makefile-by-EL" updated | Sorry, this line:EXECS += $(EXAMPLES:%/$(BIN_DIR)/%) should be replaced byEXECS += $(EXAMPLES:%=$(BIN_DIR)/%) |
468
|
11 Mar 2008 |
Stefan Ritt | Suggestion | "Makefile-by-EL" updated | The linking of mhttpd misses a "-lm":
cc -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DOS_LINUX
-fPIC -Wno-unused-function -DHAVE_ZLIB -Iinclude -Idrivers -I../mxml -o
linux/bin/mhttpd linux/lib/mhttpd.o linux/lib/mgd.o linux/lib/libmidas.a -lutil
-lpthread -lz
linux/lib/mhttpd.o(.text+0xe08f): In function `show_custom_gif':
src/mhttpd.c:5058: undefined reference to `log'
linux/lib/mhttpd.o(.text+0xe0a8):src/mhttpd.c:5058: undefined reference to `log'
The header of the makefile should contain a short description, the author(s), an
$Id:$ tag for SVN, some explanation what "icc", "ifort" means, a note about the
CFLAGS and a clear statement what can be modified by the user and why and what not. |
469
|
11 Mar 2008 |
Exaos Lee | Suggestion | "Makefile-by-EL" updated | > The linking of mhttpd misses a "-lm":
>
> cc -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB -D_LARGEFILE64_SOURCE -DOS_LINUX
> -fPIC -Wno-unused-function -DHAVE_ZLIB -Iinclude -Idrivers -I../mxml -o
> linux/bin/mhttpd linux/lib/mhttpd.o linux/lib/mgd.o linux/lib/libmidas.a -lutil
> -lpthread -lz
> linux/lib/mhttpd.o(.text+0xe08f): In function `show_custom_gif':
> src/mhttpd.c:5058: undefined reference to `log'
> linux/lib/mhttpd.o(.text+0xe0a8):src/mhttpd.c:5058: undefined reference to `log'
>
Strange. I tested it on Debian Linux 4.0r2 AMD64 with gcc 4.1.2, MIDAS SVN 4124. It worked fine.
Anyway, it can be fixed by addling "-lm" to the initial"LDFLAGS".
> The header of the makefile should contain a short description, the author(s), an
> $Id:$ tag for SVN, some explanation what "icc", "ifort" means, a note about the
> CFLAGS and a clear statement what can be modified by the user and why and what not.
OK. I will comment it in detail. |
|