sanyaade-g2g-repos / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Linker trouble due to ordering of files #248

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Brad Minch reported via maillist on 2013/05/22:

After a few hours of quality time with Google, I ran across this, which 
suggested the following solution to a similar sounding problem:

The trick here is to put the library AFTER the module you are compiling. The 
problem is a reference thing. The linker resolves references in order, so when 
the library is BEFORE the module being compiled, the linker gets confused and 
does not think that any of the functions in the library are needed. By putting 
the library AFTER the module, the references to the library in the module are 
resolved by the linker.

The linker command that scons generated had put libpmvm.a before 
pm_generated_objs.o.  I manually tried the same command only with libpmvm.a 
last on the command line and it linked without any problems.  Then, I changed 
the line in the SConscript file that builds main from

main = env.Program("main", [mapfile, platform_c_sources + pmvm_lib,
                           "#src/platform/posix64/build/pm_generated_objs.c"])

to

main = env.Program("main", [platform_c_sources, 
                           "#src/platform/pic24/build/pm_generated_objs.c", 
                           pmvm_lib])

causing scons to put libpmvm.a last on the link command line.  The build now 
proceeds from start to finish without any errors.  I still have the warning 
that I mentioned in my original post, but at least the thing builds.

Brad.

Original issue reported on code.google.com by dwhall...@gmail.com on 23 May 2013 at 3:16

GoogleCodeExporter commented 8 years ago
This issue was closed by revision be7df41001fe.

Original comment by dwhall...@gmail.com on 23 May 2013 at 3:37