I link the kung fu line
My gut feel, which could be wrong, is that something in your code is calling an unsupported function or you may have changed something in the settings that is creating a problem. Are you importing linux code from an old project or driver?
One way that might locate the problem is to create a new project (which resets all project settings for that project) and build it. If it works, then you know NetBurner.a and MOD5272.a libs are linked and working properly. Then add in your code in small bits, always with a .cpp extension or .h extension, until the problem occurs. It might take some time, but this is the best way I can think of. All references I find for unlink_r are for cygwin, which isn't used on the NetBurner platform.
Undefined references in Libc?
Re: Undefined references in Libc?
rnixon's post reminded me about a problem I would sometimes see. If you use other development tools like MinGw that modify the "path" environment variable that can screw up things. I know that Borland's C++ Builder can also cause this. The fix is to move all the c:\nburn\.... path entries to the front of the path variable. Just a thought.
Re: Undefined references in Libc?
I could only find these two references to the file unlinkr.c:
* Separate _link_r() from _unlink_r()
* libc:reent package
And you're right, they both appear to be associated with the Cygwin implementation. So why does the linker report a problem with a file that's not even supposed to be there (other implementations have the file "unlink.c", rather than "unlinkr.c")? Whose library does NetBurner use if not Cygwin?
As far as I can tell, the unlinkr.c file defines the functions remove(), unlink() and rmdir(). Of these three, only the remove() function had been referenced at all (within the Lua loslib.cpp file). I have already excluded that file from the build -- I don't need the OS interface anyway.
For what it's worth, I did have a working program until I decided to compile and link in the Lua source files. I would like to know what's in MOD5272.a and NetBurner.a. Is the source code available or is it proprietary?
* Separate _link_r() from _unlink_r()
* libc:reent package
And you're right, they both appear to be associated with the Cygwin implementation. So why does the linker report a problem with a file that's not even supposed to be there (other implementations have the file "unlink.c", rather than "unlinkr.c")? Whose library does NetBurner use if not Cygwin?
As far as I can tell, the unlinkr.c file defines the functions remove(), unlink() and rmdir(). Of these three, only the remove() function had been referenced at all (within the Lua loslib.cpp file). I have already excluded that file from the build -- I don't need the OS interface anyway.
For what it's worth, I did have a working program until I decided to compile and link in the Lua source files. I would like to know what's in MOD5272.a and NetBurner.a. Is the source code available or is it proprietary?
Last edited by acreque on Tue Nov 16, 2010 10:50 am, edited 1 time in total.
Re: Undefined references in Libc?
Tod:
Sure enough, the PATH variable had the nburn/../ stuff way at the end. Unfortunately, moving them all to the front of the string did not resolve the problem. I guess that makes sense, though, because the NBEclipse libraries entry includes the absolute path to the NetBurner libraries.
But it was a good thought.
This got my attention because I do have Cygwin installed on the same WinXP platform I'm using for the NBEclipse development. (Okay, I also have MS VCC, and NetBeans. I just like compilers)tod wrote:rnixon's post reminded me about a problem I would sometimes see. If you use other development tools like MinGw that modify the "path" environment variable that can screw up things. I know that Borland's C++ Builder can also cause this. The fix is to move all the c:\nburn\.... path entries to the front of the path variable. Just a thought.
Sure enough, the PATH variable had the nburn/../ stuff way at the end. Unfortunately, moving them all to the front of the string did not resolve the problem. I guess that makes sense, though, because the NBEclipse libraries entry includes the absolute path to the NetBurner libraries.
But it was a good thought.
Re: Undefined references in Libc?
"For what it's worth, I did have a working program until I decided to compile and link in the Lua source files. I would like to know what's in MOD5272.a and NetBurner.a. Is the source code available or is it proprietary?"
Why would it be a problem with the netburner libs if you added code which calls something that isn't in the netburner libs? I am not familiar with lua, are you positive it is appropriate and portable to an embedded system that is not linux based? Does any of its source need to be modified to make it port over?
The source for netburner.a and mod5272.a is in your dev kit release. The netburner.a is from \nburn\system. The mod5272.a is from \nburn\mod5727\system.
Why would it be a problem with the netburner libs if you added code which calls something that isn't in the netburner libs? I am not familiar with lua, are you positive it is appropriate and portable to an embedded system that is not linux based? Does any of its source need to be modified to make it port over?
The source for netburner.a and mod5272.a is in your dev kit release. The netburner.a is from \nburn\system. The mod5272.a is from \nburn\mod5727\system.
Re: Undefined references in Libc?
Here's a minimal code snippet that produces the error:
------------------------------------------------------------
#include <stdio.h> // decl for fopen()
#include <unistd.h> // decl for unlink()
extern "C" {void UserMain(void * pd);}
void doTest_01(void ){
FILE* fp = fopen("MyFile.txt", "w");
fclose(fp);
unlink("testfile.txt");
}
void UserMain(void * pd) {
printf("\nHello NetBurner World!");
doTest_01();
}
------------------------------------------------------------
If you compile and link in NBEclipse 2.5.0, you will see the undefined reference error for unlink().
I tried specifying "C:\nburn\gcc-m68k\m68k-elf\lib\libc.a" and "C:\nburn\gcc-m68k\m68k-elf\lib\m5206e\libc.a" but neither worked.
------------------------------------------------------------
#include <stdio.h> // decl for fopen()
#include <unistd.h> // decl for unlink()
extern "C" {void UserMain(void * pd);}
void doTest_01(void ){
FILE* fp = fopen("MyFile.txt", "w");
fclose(fp);
unlink("testfile.txt");
}
void UserMain(void * pd) {
printf("\nHello NetBurner World!");
doTest_01();
}
------------------------------------------------------------
If you compile and link in NBEclipse 2.5.0, you will see the undefined reference error for unlink().
I tried specifying "C:\nburn\gcc-m68k\m68k-elf\lib\libc.a" and "C:\nburn\gcc-m68k\m68k-elf\lib\m5206e\libc.a" but neither worked.
Re: Undefined references in Libc?
No takers on this one?
As mentioned in previous posts, it appears you are programming in something like linux and have not looked at what hardware you actually have. For example, when you fopen() a file and start writing to it, where do you think the file will be stored?
If you want to use a file system, you need to understand its implementation. Take a look at the EFFS docs in the \nburn\docs directory. I would also take a look at the Network Programmers Guide to see some code examples.
It might help to get some background on your programming experience. What types of embedded systems have you developed on before? Maybe there are some comparisons that will help.
As mentioned in previous posts, it appears you are programming in something like linux and have not looked at what hardware you actually have. For example, when you fopen() a file and start writing to it, where do you think the file will be stored?
If you want to use a file system, you need to understand its implementation. Take a look at the EFFS docs in the \nburn\docs directory. I would also take a look at the Network Programmers Guide to see some code examples.
It might help to get some background on your programming experience. What types of embedded systems have you developed on before? Maybe there are some comparisons that will help.