edgexfoundry / edgexfoundry/device-bacnet-c
undefined reference to `edgex_device_add_device'
- Dominant language
- C
- Stars
- 16
- Forks
- 22
- Avg merge
- 21h 15m
- Merged PRs (30d)
- 1
Description
Hello,
Installed geneva csdk on Ubuntu 20.04 and I just have tested device-bacnet-c.
But when I use ./src/build.sh, I can't complete.
+ readlink -f ./scripts/build.sh
+ dirname /home/ubuntu/work/edgeXsrc/device-bacnet-c/scripts/build.sh
+ dirname /home/ubuntu/work/edgeXsrc/device-bacnet-c/scripts
+ ROOT=/home/ubuntu/work/edgeXsrc/device-bacnet-c
+ echo /home/ubuntu/work/edgeXsrc/device-bacnet-c
/home/ubuntu/work/edgeXsrc/device-bacnet-c
+ cd /home/ubuntu/work/edgeXsrc/device-bacnet-c
+ [ ! -f /home/ubuntu/work/edgeXsrc/device-bacnet-c/lib/ip/libbacnet.a ]
+ [ ! -f /home/ubuntu/work/edgeXsrc/device-bacnet-c/lib/mstp/libbacnet.a ]
+ mkdir -p /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-ip
+ cd /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-ip
+ cmake -DDATALINK:STRING=BACDL_BIP=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release /home/ubuntu/work/edgeXsrc/device-bacnet-c/src/c
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-ip
+ make
+ tee release.log
[ 22%] Built target bacnet_objects
[ 33%] Linking C executable device-bacnet-c
/usr/bin/ld: CMakeFiles/device-bacnet-c.dir/main.c.o: in function `bacnet_discover':
main.c:(.text+0x59c): undefined reference to `edgex_device_add_device'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/device-bacnet-c.dir/build.make:162: device-bacnet-c] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/device-bacnet-c.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
+ mkdir -p /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-mstp
+ cd /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-mstp
+ cmake -DDATALINK:STRING=BACDL_MSTP=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release /home/ubuntu/work/edgeXsrc/device-bacnet-c/src/c
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/work/edgeXsrc/device-bacnet-c/build/release/device-bacnet-mstp
+ + teemake release.log
[ 22%] Built target bacnet_objects
[ 33%] Linking C executable device-bacnet-c
/usr/bin/ld: CMakeFiles/device-bacnet-c.dir/main.c.o: in function `bacnet_discover':
main.c:(.text+0x58c): undefined reference to `edgex_device_add_device'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/device-bacnet-c.dir/build.make:162: device-bacnet-c] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/device-bacnet-c.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
--------------------------------------------------------------------------------------------------------------
Installed csdk-1.3.0, I can't also find on CSDK library.
$ readelf -s libcsdk.so | grep edgex_device_add
538: 0000000000034cc8 8 FUNC GLOBAL DEFAULT 11 edgex_device_add_profile
1014: 0000000000034cc8 8 FUNC GLOBAL DEFAULT 11 edgex_device_add_profile
Where is edgex_device_add_device ?
All the best,
Ryan
--------------------------------------------------------------------------------------------------------------
Contributor guide
Research direction
Start with src/c/main.c at bacnet_discover and inspect src/build.sh and the CMake configuration to see how libcsdk.so is linked. Compare the requested edgex_device_add_device symbol with the installed csdk-1.3.0 symbols, then verify that the device-bacnet-ip and device-bacnet-mstp builds complete successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100