Problem linking Squirrel language with SqPlus

Member
Posts: 312
Joined: 2006.10
Post: #1
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
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
without looking at the source...

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

// the rest of your C++ code here
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #3
No, because Squirrel and SqPlus are written in C++.
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #4
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.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Oh, you've got a single-architecture library and you're trying to build a universal binary.
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #6
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)
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #7
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
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
You've still got a single-architecture library and trying to build a UB...
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #9
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!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pascal language (pointer) problem sealfin 3 4,397 Nov 27, 2012 04:38 AM
Last Post: sealfin
  Problem Weak-linking a framework in Code Warrior 9.6 lord_nemesis 2 2,704 Nov 25, 2005 01:00 AM
Last Post: lord_nemesis