I'm trying to run python code in an embedded interpreter for arm devices; built in visual studio 2012, using marmalade studio.
I've built my archive static link library, libpython.a, and placed under \lib\arm\libpython.a (and libpython_d.a)
I've compiled the python libraries for ARM, loading in 'libpython.a' seems to work fine, "VS:intellisense" gave me errors when I specified the wrong extern function argument data type. (that's a good thing, means something is connected atleast)
my marmalade .mkb build file looks like so:
files
{
RunPython.cpp
}
subprojects
{
}
librarys
{
<arm_shared>
"./lib,libpython"
}
RunPython.cpp
extern void PyRun_SimpleString(const char*);
extern void Py_Initialize(void);
extern void Py_Finalize(void);
const char *pycode=
"print('This is python code')\n";
// Main entry point for the application
int main()
{
//python shared library test
Py_Initialize();
PyRun_SimpleString(pycode);
Py_Finalize();
return 0;
}
Question: Options i have in dealing with? error MSB6006: "link.exe" exited with code 1.
I have whole program optimization turned off
UPDATE:
I have re-installed my dev environment on a fresh windows-7 64bit install with visual studio 2012 express and marmalade 7.2 installed.
i've added appropriate links within my project file; still receive: error MSB6006: "link.exe" exited with code 1.
i decided to investigate with processmonitor:process tree to see the directories it's accessing at run time (keeping in mind the library i need is in a folder called "libpython":
arm-none-eaabi-g++.exe
command:
"c:/marmalade/7.2/s3e/gcc/win32/bin/arm-none-eabi-g++.exe" "@arm-none-eabi-g++_cmd_line_MainThread.txt"
childprocess:
collect2.exe
command:
"c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/collect2.exe" "--sysroot=c:\marmalade\7.2\s3e\gcc\win32\bin\../arm-none-eabi" "-X" "-pie" "-o" "Debug_RunPython_vc11x_gcc_arm/RunPython.elf" "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/crti.o" "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/crtbegin.o" "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/crt0.o" "-Lc:/marmalade/7.2/s3e/lib/arm" "-Lc:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4" "-Lc:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc" "-Lc:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib" "-Lc:/marmalade/7.2/s3e/gcc/win32/bin/../arm-none-eabi/lib" "@C:\Users\root\AppData\Local\Temp\cc8DfmXx" "--start-group" "-lgcc" "-lc" "--end-group" "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/crtend.o" "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/crtn.o"
childprocess:
ld.exe
command: "c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe" "@C:\Users\root\AppData\Local\Temp\cce3XLB7"
any ideas as to why linker inst even looking in the directories? there must be something i'm doing wrong or it's a marmalade specific problem i'm going to try and put my library in the folders it does look in, see if that works
another thing thats puzzling is the that there is NO SPACE between arguments -l and python
1> c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: cannot find -lC:/Marmalade/7.2/s3e/lib/arm/python_d.a
EDIT: Error 1 error : ld returned 1 exit status collect2.exe Is a linker problem
1> Build started: Project: RunPython_vc11x, Configuration: GCC ARM Debug Win32
1> ARM Compiling(GCC) c:\python_compile\RunPython.cpp ...
1> ARM Linking(GCC) ...
1> c:/marmalade/7.2/s3e/gcc/win32/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: cannot find -llibpython_d
1>collect2.exe : error : ld returned 1 exit status
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I solved it by adding my library directory under properties (with / rather than \, kind-of counter intuitive):
C/C++ >general> Additional include directories : using c:/.../lib/arm (NOT C:...\lib\arm) Linker>general> Additional include directories : using c:/.../lib/arm (NOT C:...\lib\arm) Linker>input> additional dependencies: libpython_d.a
EDIT: I was having trouble before with visual studio saying "function too many arguments" but I found out it was just a matter of going back to the python header files to match my extern datatype with the library functions datatype.