1

I have two object files, one with a symbol that is undefined (from standard input):

bin/src/ghdl_grt/ghwlib.c.o:                 U sched_getstreams

...and one with the same symbol that is defined:

bin/src/nuttx/nuttx/nuttx.o:0000000000004f0c T sched_getstreams

When I try to link them together, the symbol is for some reason still undefined:

$ ld bin/src/ghdl_grt/ghwlib.c.o bin/src/nuttx/nuttx/nuttx.o -o test.o -lc
ld: warning: cannot find entry symbol _start; defaulting to 0000000000401140
ld: bin/src/ghdl_grt/ghwlib.c.o: in function `ghw_read_range(ghw_handler*)':
/home/jon/controlix-code/src/ghdl_grt/ghwlib.c:351: undefined reference to `sched_getstreams'

What am I missing?

jww
  • 97,681
  • 90
  • 411
  • 885
Jon Taylor
  • 181
  • 1
  • 9
  • edit your Q to include the line of code that is executed to produce the `ghwlib.c.o` file? Good luck. – shellter Aug 22 '19 at 14:03
  • 1
    Probably a library. is missing. Strongly suggest posting the source code for these two files, your compile statements, and your link statement. – user3629249 Aug 22 '19 at 14:03
  • I don't see why the build lines are relevant; I see the two files, one has a symbol which is undefined and one which has the defined symbol. Why is how I produced the output relevant to why a simple link isn't matching the two symbols? If it makes any difference, the actual linker step isn't part of the build process which produced the two object files and was done by hand to illustrate the problem. – Jon Taylor Aug 22 '19 at 14:24
  • It may be worth mentioning... The latest version of [`ghwlib.c`](https://github.com/ghdl/ghdl/blob/master/src/grt/ghwlib.c) does not use `sched_getstreams` in `ghw_read_range`. It might be time to update your external sources. – jww Aug 22 '19 at 17:38
  • EDIT: I found the problem (I think). The nuttx.o object file was actually being created as a dynamically linked executable, not as a shared object (.so) file. I apologize to the previous poster - the process of building the nuttx.o file _was_ important. I ended up finding the needed shared object files alsewhere in the NuttX build tree and using those instead.... – Jon Taylor Aug 22 '19 at 22:49
  • @John - You should consider answering your own question. Also see [How does accepting an answer work?](https://meta.stackexchange.com/q/5234/173448). – jww Aug 23 '19 at 04:06

0 Answers0