iDevGames Forums
Problem linking Squirrel language with SqPlus - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: Problem linking Squirrel language with SqPlus (/thread-3135.html)



Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 1, 2007 10:37 AM

Hey,

I've been getting into the Squirrel scripting language lately. I was able to use strictly the Squirrel language and it's standard library, but when trying to add SqPlus (the binding lib) I gett a bunch of linking errors and warning: http://rafb.net/p/npscZs75.html

I was hoping someone could look at my project, and see if they can get it to compile?
http://www.sendspace.com/file/779q6a
The only thing that would need to be changed is the file path the test.nut. I'm running an Intel Mac, and I'm not sure if the libs are UB.

If anyone feels like compiling the Squirrel and SqPlus, they can be found here: squirrel-lang.org (and SqPlus can be found on the wiki).

Thanks!
-Jedd


Problem linking Squirrel language with SqPlus - OneSadCookie - Aug 1, 2007 01:15 PM

without looking at the source...

Code:
extern "C" {
#include <squirrel.h>
}

// the rest of your C++ code here



Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 1, 2007 01:28 PM

No, because Squirrel and SqPlus are written in C++.


Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 1, 2007 01:36 PM

Now, I'm only getting undefined references and symbols to SqPlus object files (.o).

Btw, in the Build Results window, I switched it so I could see the Build Log, but now I can't switch it back to only the warnings/errors, because the 4 little button you see in the window have disappeared.


Problem linking Squirrel language with SqPlus - OneSadCookie - Aug 1, 2007 03:23 PM

Oh, you've got a single-architecture library and you're trying to build a universal binary.


Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 1, 2007 04:35 PM

Edit - I tried making a project, created three different targets (squirrel, squirrel standard lib, and sqplus), and added the appropriate source/header files. I built each one, no problems there. So, now I go to add to my other project where I'm actually building an example, and I get the same errors. Just thought I'd mention this.

How can I edit the makefile to build UB libs? Or is it possible to build lib files with Xcode, and just dump the source files into a Xcode project, and let Xcode build a UB .a file?

Thanks OSC!!

Squirrel makefile:
Code:
SQUIRREL= ..


OUT= $(SQUIRREL)/lib/libsquirrel.a
INCZ= -I$(SQUIRREL)/include -I. -Iinclude
DEFS=
LIB=    

OBJS= \
    sqapi.o \
    sqbaselib.o \
    sqcompiler.o \
    sqdebug.o \
    sqlexer.o \
    sqobject.o \
    sqparser.o \
    sqstate.o \
    sqtable.o \
    sqvm.o \
    sqmem.o \
    sqclass.o
    
SRCS= \
    sqapi.cpp \
    sqbaselib.cpp \
    sqfuncstate.cpp \
    sqdebug.cpp \
    sqlexer.cpp \
    sqobject.cpp \
    sqcompiler.cpp \
    sqstate.cpp \
    sqtable.cpp \
    sqmem.cpp \
    sqvm.cpp \
    sqclass.cpp

    
    
sq32:
    gcc -O2  -fno-rtti -Wall -c $(SRCS) $(INCZ) $(DEFS)
    ar rc $(OUT) *.o
    rm *.o

sqprof:
    gcc -O2 -pg -fno-rtti -pie -gstabs -g3 -Wall -c $(SRCS) $(INCZ) $(DEFS)
    ar rc $(OUT) *.o
    rm *.o

sq64:
    gcc -O2  -D_SQ64 -fno-rtti -Wall -c $(SRCS) $(INCZ) $(DEFS)
    ar rc $(OUT) *.o
    rm *.o

Squirrel Standard Lib Makefile:
Code:
SQUIRREL= ..


OUT= $(SQUIRREL)/lib/libsqstdlib.a
INCZ= -I$(SQUIRREL)/include -I. -Iinclude

SRCS= \
    sqstdblob.cpp \
    sqstdio.cpp \
    sqstdstream.cpp \
    sqstdmath.cpp \
    sqstdsystem.cpp \
    sqstdstring.cpp \
    sqstdaux.cpp \
    sqstdrex.cpp
    
    
sq32:
    gcc -O2  -fno-rtti -Wall -c $(SRCS) $(INCZ)
    ar rc $(OUT) *.o
    rm *.o

sqprof:
    gcc -O2 -pg -fno-rtti -pie -gstabs -g3 -Wall -c $(SRCS) $(INCZ)
    ar rc $(OUT) *.o
    rm *.o
sq64:
    gcc -O2 -D_SQ64 -fno-rtti -Wall -c $(SRCS) $(INCZ)
    ar rc $(OUT) *.o
    rm *.o

SqPlus Makefile:
Code:
SQUIRREL= ..

OUT= $(SQUIRREL)/lib/libsqplus.a
INCDIRS= -I$(SQUIRREL)/include -I. -Iinclude

ALLSRCS = $(wildcard *.cpp)
WIN32SRCS = $(wildcard *Win32*)
SRCS = $(filter-out $(WIN32SRCS),$(ALLSRCS))
    
sqplus:
#    g++ -fno-rtti -c $(SRCS) $(INCDIRS)
    g++ -O3  -fno-rtti -Os -c $(SRCS) $(INCDIRS)
    ar rc $(OUT) *.o
    rm *.o
    

#g++ -O3  -fno-rtti -Os -c $(SRCS) $(INCDIRS)
#g++ -ggdb  -fno-rtti -c $(SRCS) $(INCDIRS)



Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 3, 2007 05:05 PM

Any other help? I Still can't get this too work. Here's the warnings/errors I get when using the lib built with Xcode, if it helps..

http://rafb.net/p/eEbqmH38.html


Problem linking Squirrel language with SqPlus - OneSadCookie - Aug 3, 2007 05:16 PM

You've still got a single-architecture library and trying to build a UB...


Problem linking Squirrel language with SqPlus - bronxbomber92 - Aug 3, 2007 05:46 PM

Well, how do I build UB?

Even if I didn't build a UB, shouldn't it still work since I built it for my architecture?

Edit - I figured it out, after going through apple mailing lists!