Experimental Physics and Industrial Control System
|
Hi Aaron,
Change these lines:
caMonitor_SYS_LIBS += -I/usr/include/mysql
USR_LDFLAGS += -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto
to this:
USR_CFLAGS += -I/usr/include/mysql
USR_LDFLAGS += -L/usr/lib64/
caMonitor_SYS_LIBS += mysql mysqlclient pthread z m dl ssl crypto
The USR_LDFLAGS line is almost certainly not needed, because it will search that library by default.
You can probably also remove pthread and m from caMonitor_SYS_LIBS because EPICS base uses those by default.
Mark
So, here is what I have changed my Makefile to:
TOP=..
include $(TOP)/configure/CONFIG
#----------------------------------------
# ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================
caExample_SRCS += caExample.c
caExample_LIBS += $(EPICS_BASE_HOST_LIBS)
caMonitor_SRCS += caMonitor.c
caMonitor_SYS_LIBS += -I/usr/include/mysql
USR_LDFLAGS += -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE
Now the error I am getting is:
"cannot find -l-I/usr/include/mysql" even though that is what running mysql_config --cflags returns. Did I do this correctly?
Your Makefile should be changed to
caMonitor _SYS_LIBS += all your libraries without the -l in front of each.
The -L is probably not needed but it would go in
USR_LDFLAGS += -L ...
Mark
Sent from my iPhone
On Dec 3, 2019, at 8:58 AM, Aaron Brown <[email protected]<mailto:[email protected]>> wrote:
This is what my make file looks like:
TOP=..
include $(TOP)/configure/CONFIG
#----------------------------------------
# ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================
PROD_HOST += caExample
caExample_SRCS += caExample.c
caExample_LIBS += $(EPICS_BASE_HOST_LIBS)
PROD_HOST += caMonitor
caMonitor_SRCS += caMonitor.c
caMonitor_LIBS += $(EPICS_BASE_HOST_LIBS)
MYSQLCFLAGS += -I/usr/include/mysql
MYSQLLIBS += -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE
I have highlighted my additions in yellow. I got the library paths from running mysql_config --cflags --libs.
________________________________
From: Mark Rivers <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2019 8:39 AM
To: Aaron Brown <[email protected]<mailto:[email protected]>>
Cc: tech-talk <[email protected]<mailto:[email protected]>>
Subject: [EXTERNAL] Re: MySQL statement in caMonitor code
Please send the Makefile.
________________________________
From: Aaron Brown <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2019 7:18 AM
To: Mark Rivers
Cc: tech-talk
Subject: Re: MySQL statement in caMonitor code
Hi Mark,
I tried that, but everything I did returned some sort of "missing separator" error.
I tried typing the paths to the libraries at the end of the Makefile and at the beginning.
I even tried this:
MYSQLLIBS += <path to libraries>
I keep getting the same "missing separator" error.
Thanks,
Aaron Brown
Detector Support Group
Jefferson Lab
________________________________
From: Mark Rivers <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2019 8:10 AM
To: Aaron Brown <[email protected]<mailto:[email protected]>>
Cc: tech-talk <[email protected]<mailto:[email protected]>>
Subject: [EXTERNAL] Re: MySQL statement in caMonitor code
> I think this means there is a linker issue, but am not sure how to fix this.
Did you modify the Makefile to add the MySQL libraries to those that should be linked with?
Mark
________________________________
From: Tech-talk <[email protected]<mailto:[email protected]>> on behalf of Aaron Brown via Tech-talk <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2019 6:50 AM
To: [email protected]<mailto:[email protected]>
Subject: MySQL statement in caMonitor code
Hello all,
I have embedded a MySQL statement in the caMonitor example code. I have included all the necessary header files, I think, but when I compile it complains of undefined references:
caMonitor.o: In function `eventCallback':
/home/ambrown/3rdTest/3rdTestApp/O.linux-x86_64/../caMonitor.c:74: undefined reference to `mysql_init'
/home/ambrown/3rdTest/3rdTestApp/O.linux-x86_64/../caMonitor.c:75: undefined reference to `mysql_real_connect'
/home/ambrown/3rdTest/3rdTestApp/O.linux-x86_64/../caMonitor.c:92: undefined reference to `mysql_query'
/home/ambrown/3rdTest/3rdTestApp/O.linux-x86_64/../caMonitor.c:93: undefined reference to `mysql_close'
collect2: error: ld returned 1 exit status
I think this means there is a linker issue, but am not sure how to fix this.
Any ideas?
Thanks
Aaron Brown
Detector Support Group
Jefferson Lab
|
- Replies:
- Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- References:
- MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Re: MySQL statement in caMonitor code Mark Rivers via Tech-talk
- Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Re: MySQL statement in caMonitor code Mark Rivers via Tech-talk
- Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Re: MySQL statement in caMonitor code Mark Rivers via Tech-talk
- Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Navigate by Date:
- Prev:
Re: How to set timeout for reading a pyepics device attribute [SEC=UNOFFICIAL] Matt Newville via Tech-talk
- Next:
Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Next:
Re: MySQL statement in caMonitor code Aaron Brown via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
|
ANJ, 03 Dec 2019 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|