First post here..and thanks in advance for anyone who replies.
I am trying to use SMILE in a 64bit system with RHEL4 installed. I have two gcc, one is v3.4.6, the other is v4.1.2. I've downloaded the unix-based SMILE package compiled using gcc-4.1.2 and tried installing it in my system I've encountered some problems.
To make things clearer, here's what my Makefile looks like:
================
CC = g++
SMILE = /opt/smile64
CFLAGS = -O3 -DNDEBUG -ffast-math
try: try.o
$(CC) $(CFLAGS) try.o -o try\
$(SMILE)/libsmilearn.a $(SMILE)/libsmilexml.a $(SMILE)/libsmile.a
try.o: try.cpp
$(CC) $(CFLAGS) -c try.cpp -I$(SMILE)
clean:
rm -rf *.o
rm -rf try
===============
try.cpp looks like this:
===============
#include "smile.h"
#include "network.h"
int main()
{
DSL_network newNet;
newNet.ReadFile("myNet.xdsl");
return 0;
}
===============
myNet.xdsl is actually a simple Bayesian network which I've generated using GeNIe and tested to be working.
Now, here's the part I can't comprehend. When I type "make", I got the following errors:
/opt/smile64/libsmile.a(network.o)(.text+0x2201): In function 'DSL_network::CheckConsistency(int)':: undefined reference to '__stack_chk_fail'
/opt/smile64/libsmile.a(network.o)(.text+0x486d): In function 'DSL_network::CreateUniqueNodeIdentifier(char*)':: undefined reference to '__stack_chk_fail'
/opt/smile64/libsmile.a(network.o)(.text+0x4b31): In function 'DSL_network::AddNode(int, char*)':: undefined reference to '__stack_chk_fail'
/opt/smile64/libsmile.a(network.o)(.text+0x9792): In function 'DSL_network::FunctionDetermine(int)':: undefined reference to '__stack_chk_fail'
/opt/smile64/libsmile.a(network.o)(.text+0xcff6): In function 'DSL_network::RelevenceEvidenceSet(int)':: undefined reference to '__stack_chk_fail'
/opt/smile64/libsmile.a(pearl.o)(.text+0xb87): more undefined references to '__stack_chk_fail' follow
collect2: ld returned 1 exit status
make: *** [try] Error 1
Will appreciate it greatly if anyone can shed some light into this.
Compiling SMILE in 64 bit OS and machines
Compiling SMILE in 64 bit OS and machines
Last edited by djinn on Wed Dec 05, 2007 6:29 am, edited 1 time in total.
-
- Site Admin
- Posts: 1419
- Joined: Mon Nov 26, 2007 5:51 pm
It looks like our 64-bit Linux system enables the stack-smashing protection by default. More info here:
http://en.wikipedia.org/wiki/Stack-smashing_protection
Try adding "-fstack-protector" or "-fstack-protector-all" to your CCFLAGS.
http://en.wikipedia.org/wiki/Stack-smashing_protection
Try adding "-fstack-protector" or "-fstack-protector-all" to your CCFLAGS.
Thanks a lot! I managed to compile the code. However, I have problems running it. I get the message:
./try: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory
Think I'm missing a library somewhere.
EDIT:
I tried to force the link to my /opt/gcc-4.1.2/lib directory but I got these messages:
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp_nonshared.a when searching for -lssp_nonshared
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp.so when searching for -lssp
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp.a when searching for -lssp
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libgcc_s.so when searching for -lgcc_s
And if I link to /opt/gcc-4.1.2/lib64 directory, linking was done but I still get "error while loading shared libraries: libssp.so.0..." message when executing ./try
Hmm...
=======================
Managed to resolve the problem! Realized I need to export the path to gcc-4.1.2/lib64 so basically, just type in:
LD_LIBRARY_PATH=/opt/gcc-4.1.2/lib64/
export LD_LIBRARY_PATH
and run ./try again. Apparently, it runs. So now, I can start working on doing inferencing using SMILE.
./try: error while loading shared libraries: libssp.so.0: cannot open shared object file: No such file or directory
Think I'm missing a library somewhere.
EDIT:
I tried to force the link to my /opt/gcc-4.1.2/lib directory but I got these messages:
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp_nonshared.a when searching for -lssp_nonshared
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp.so when searching for -lssp
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libssp.a when searching for -lssp
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /opt/gcc412/lib//libgcc_s.so when searching for -lgcc_s
And if I link to /opt/gcc-4.1.2/lib64 directory, linking was done but I still get "error while loading shared libraries: libssp.so.0..." message when executing ./try
Hmm...
=======================
Managed to resolve the problem! Realized I need to export the path to gcc-4.1.2/lib64 so basically, just type in:
LD_LIBRARY_PATH=/opt/gcc-4.1.2/lib64/
export LD_LIBRARY_PATH
and run ./try again. Apparently, it runs. So now, I can start working on doing inferencing using SMILE.
Last edited by djinn on Wed Dec 05, 2007 2:39 am, edited 1 time in total.
-
- Site Admin
- Posts: 1419
- Joined: Mon Nov 26, 2007 5:51 pm
Yes, I have the library in my gcc-4.1.2/lib64 folder but I realized I had to specify this library path in my Makefile, otherwise, the error will occur.
Thanks again, shooltz!
Anyway, to make it clearer to anyone looking at this thread, my Makefile looks like this now:
=====================
CC = g++
SMILE = /opt/smile64
CFLAGS = -fstack-protector -fstack-protector-all -O3 -DNDEBUG -ffast-math
SSPLIB = /opt/gcc412/lib64/libssp.so.0
try: try.o
$(CC) $(CFLAGS) try.o -o try $(SSPLIB)\
$(SMILE)/libsmilearn.a $(SMILE)/libsmilexml.a $(SMILE)/libsmile.a
try.o: try.cpp
$(CC) $(CFLAGS) -c try.cpp -I$(SMILE) $(SSPLIB)
clean:
rm -rf *.o
rm -f try
=================
Compilation works and the code runs fine at this moment if it reads in a .DSL file which it generates (but not a .DSL file generated by GeNIe).
Thanks again, shooltz!
Anyway, to make it clearer to anyone looking at this thread, my Makefile looks like this now:
=====================
CC = g++
SMILE = /opt/smile64
CFLAGS = -fstack-protector -fstack-protector-all -O3 -DNDEBUG -ffast-math
SSPLIB = /opt/gcc412/lib64/libssp.so.0
try: try.o
$(CC) $(CFLAGS) try.o -o try $(SSPLIB)\
$(SMILE)/libsmilearn.a $(SMILE)/libsmilexml.a $(SMILE)/libsmile.a
try.o: try.cpp
$(CC) $(CFLAGS) -c try.cpp -I$(SMILE) $(SSPLIB)
clean:
rm -rf *.o
rm -f try
=================
Compilation works and the code runs fine at this moment if it reads in a .DSL file which it generates (but not a .DSL file generated by GeNIe).