Troubles with serial module

BlitzMax Forums/Brucey's Modules/Troubles with serial module

lonnieh(Posted 2015) [#1]
I'm really having a hard time with this. I have downloaded and successfully built nearly all of Brucey's mods with my current setup:

Windows 8.1 x64
BlitzMax 1.50
TDM-GCC 4.7.1

However if I try to run one of the included samples or anything that includes it I get this:
Building example_01.bmx
Linking:example_01.debug.exe
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1f6): undefined reference to `serial::Serial::Serial(std::string const&, unsigned int, serial::Timeout, serial::bytesize_t, serial::parity_t, serial::stopbits_t, serial::flowcontrol_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x357): undefined reference to `serial::Serial::Serial(std::string const&, unsigned int, serial::Timeout, serial::bytesize_t, serial::parity_t, serial::stopbits_t, serial::flowcontrol_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x611): undefined reference to `serial::Serial::open()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x6eb): undefined reference to `serial::Serial::close()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x6fb): undefined reference to `serial::Serial::isOpen() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x74d): undefined reference to `serial::Serial::available()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x87d): undefined reference to `serial::Serial::read(unsigned char*, unsigned int)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0xa52): undefined reference to `serial::Serial::readline(unsigned int, std::string)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0xcc9): undefined reference to `serial::Serial::write(unsigned char const*, unsigned int)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0xe8f): undefined reference to `serial::Serial::write(std::string const&)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x10da): undefined reference to `serial::Serial::setPort(std::string const&)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1274): undefined reference to `serial::Serial::getPort() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1338): undefined reference to `serial::Serial::setBaudrate(unsigned int)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1415): undefined reference to `serial::Serial::getBaudrate() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1461): undefined reference to `serial::Serial::setBytesize(serial::bytesize_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x153e): undefined reference to `serial::Serial::getBytesize() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x158a): undefined reference to `serial::Serial::setParity(serial::parity_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1667): undefined reference to `serial::Serial::getParity() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x16b3): undefined reference to `serial::Serial::setStopbits(serial::stopbits_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1790): undefined reference to `serial::Serial::getStopbits() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x17dc): undefined reference to `serial::Serial::setFlowcontrol(serial::flowcontrol_t)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x18b9): undefined reference to `serial::Serial::getFlowcontrol() const'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x18ff): undefined reference to `serial::Serial::flush()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1a5c): undefined reference to `serial::Serial::flushInput()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1b6c): undefined reference to `serial::Serial::flushOutput()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1c82): undefined reference to `serial::Serial::sendBreak(int)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1da4): undefined reference to `serial::Serial::setBreak(bool)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1ec6): undefined reference to `serial::Serial::setRTS(bool)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x1fe8): undefined reference to `serial::Serial::setDTR(bool)'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x20fb): undefined reference to `serial::Serial::waitForChange()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x220b): undefined reference to `serial::Serial::getCTS()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x2382): undefined reference to `serial::Serial::getDSR()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x24f9): undefined reference to `serial::Serial::getRI()'
D:/Development/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a(glue.cpp.debug.win32.x86.o):glue.cpp:(.text+0x2670): undefined reference to `serial::Serial::getCD()'
Build Error: Failed to link D:/Development/BlitzMax/mod/bah.mod/serial.mod/examples/example_01.debug.exe
process complete


However.... if I save the file into my blitzmax lib folder, it compiles! As far as I know my path is set correctly. I have ran other things before and I also using my TDM-GCC setup for Monkey-X. Any ideas?


lonnieh(Posted 2015) [#2]
Edit: Sorry, I'm crazy, it does not compile no matter where I put it.


Brucey(Posted 2015) [#3]
I just did a test on XP with a clean copy of the latest bah.serial from the SVN repository.
From the command line:
C:\Program Files\BlitzMax\bin>bmk makemods -a bah.serial
Compiling:serial.cc
Compiling:win.cc
Compiling:glue.cpp
Compiling:list_win32.cpp
Compiling:source.bmx
flat assembler  version 1.68  (1267315 kilobytes memory)
3 passes, 459 bytes.
Compiling:common.bmx
flat assembler  version 1.68  (1267718 kilobytes memory)
3 passes, 1639 bytes.
Compiling:serial.bmx
flat assembler  version 1.68  (1267586 kilobytes memory)
4 passes, 32619 bytes.
Archiving:serial.debug.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/bah.mod/serial.mod/serial.debug.win32.x86.a
Compiling:serial.cc
Compiling:win.cc
Compiling:glue.cpp
Compiling:list_win32.cpp
Compiling:source.bmx
flat assembler  version 1.68  (1265781 kilobytes memory)
3 passes, 295 bytes.
Compiling:common.bmx
flat assembler  version 1.68  (1265726 kilobytes memory)
3 passes, 460 bytes.
Compiling:serial.bmx
flat assembler  version 1.68  (1265655 kilobytes memory)
3 passes, 15065 bytes.
Archiving:serial.release.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/bah.mod/serial.mod/serial.release.win32.x86.a

Then in the IDE, it built the example_01 program okay, and I was able to run it.

Your error implies that the serial library itself wasn't compiled for some reason, and therefore wasn't linked into the final binary.


lonnieh(Posted 2015) [#4]
Well, hello there. Your SVN is the source for my local copy as well. When I start to build modules I don't see either line
Compiling:serial.cc
or
Compiling:win.cc


I must be doing something wrong. Does the OS matter? I have an old XP VM on here, I'll try compiling on that.


Brucey(Posted 2015) [#5]
No the OS doesn't matter. I also tested it on Linux, and it worked there too ;-)

You *may* need my custom bmk to compile .cc files... (off the top of my head this is the only thing that comes to mind why those in particular are not being picked up by the compiler)

.cc is a different suffix for .cpp files that some people like to use.

You can find the latest version here : https://github.com/bmx-ng/bmk
There's a "Download ZIP" button on the right of the page.
It should compile with your standard BlitzMax. Once you have the bmk.exe, you can copy that and two other files (core.bmk and make.bmk) into your BlitzMax/bin folder. I'd suggest backing up your official bmk.exe first, though.

Please let me know how you get on :-)


lonnieh(Posted 2015) [#6]
Absolutely fantastic. Found your donate link, have a drink (or something) on me.


Brucey(Posted 2015) [#7]
Thanks!

:o)


lonnieh(Posted 2015) [#8]
Hey Brucey, just curious about something regarding running in debug vs release. When I call TSerial.listPorts() in release mode it works perfect, and when I'm in debug I get the message: "Unhandled Exception:Can't insert Null object into the list". Anything come to mind seeing that? If not no biggie!