Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Error: Unable to read VERSION file #94

Open
M0hanrajp opened this issue Aug 17, 2024 · 7 comments
Open

CMake Error: Unable to read VERSION file #94

M0hanrajp opened this issue Aug 17, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@M0hanrajp
Copy link

🐞 Bug Report

Affected Services [REQUIRED]

https://github.com/edgexfoundry/device-bacnet-c.git

device-bacnet-c is affected due to cmake error while executing ./scripts/build.sh

Is this a regression?

Currently I'm facing this error when cloning v3.1.0 & v3.0.1 ( I have not checked other versions )

Description and Minimal Reproduction [REQUIRED]

  • Clone the repository.
  • perform git checkout to v3.x.x
  • Run ./scripts/build.sh
  • Observe the error.

🔥 Exception or Error

Error snippet:

-- Found IOT: /opt/iotech/iot/1.5/lib/libiot.so
-- /opt/iotech/iot/1.5/include
CMake Error at CMakeLists.txt:61 (FILE):
  FILE STRINGS file
  "/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/src/c/../../VERSION"
  cannot be read.


-- Configuring incomplete, errors occurred!
See also "/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/build/release/device-bacnet-ip/CMakeFiles/CMakeOutput.log".

Full Error logs:

/device-bacnet-c$ ./scripts/build.sh
+ readlink -f ./scripts/build.sh
+ dirname /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/scripts/build.sh
+ dirname /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/scripts
+ ROOT=/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c
+ echo /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c
/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c
+ cd /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c
+ [ ! -f /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/lib/ip/libbacnet.a ]
+ [ ! -d /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/bacnet-stack ]
+ git clone https://github.com/IOTechSystems/bacnet-stack.git
Cloning into 'bacnet-stack'...
remote: Enumerating objects: 33475, done.
remote: Counting objects: 100% (176/176), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 33475 (delta 99), reused 160 (delta 94), pack-reused 33299 (from 1)
Receiving objects: 100% (33475/33475), 24.11 MiB | 534.00 KiB/s, done.
Resolving deltas: 100% (24059/24059), done.
Updating files: 100% (1686/1686), done.
+ cd /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/bacnet-stack
+ git checkout v0.8.6-IOTech
Note: switching to 'v0.8.6-IOTech'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 8b67b7f2 Changes for BACnet device service
+ mkdir -p /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/lib/ip
+ mkdir -p /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/lib/mstp
+ make BACDL_DEFINE=-DBACDL_MSTP=1 clean library
make -s -C lib clean
make -s -C demo clean
make -s -C demo/router clean
make -s -C demo/router-ipv6 clean
make -s -C demo/gateway clean
make -s -C lib all
+ cp lib/libbacnet.a /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/lib/mstp
+ make BACDL_DEFINE=-DBACDL_BIP=1 clean library
make -s -C lib clean
make -s -C demo clean
make -s -C demo/router clean
make -s -C demo/router-ipv6 clean
make -s -C demo/gateway clean
make -s -C lib all
+ cp lib/libbacnet.a /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/lib/ip
+ mkdir -p /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/build/release/device-bacnet-ip
+ cd /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/build/release/device-bacnet-ip
+ cmake -DDATALINK:STRING=BACDL_BIP=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release /home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/src/c
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found IOT: /opt/iotech/iot/1.5/lib/libiot.so
-- /opt/iotech/iot/1.5/include
CMake Error at CMakeLists.txt:61 (FILE):
  FILE STRINGS file
  "/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/src/c/../../VERSION"
  cannot be read.


-- Configuring incomplete, errors occurred!
See also "/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/build/release/device-bacnet-ip/CMakeFiles/CMakeOutput.log".

🌍 Your Environment

Deployment Environment: Ubuntu 22.04

EdgeX Version [REQUIRED]: 3.1.1 - Napa

@M0hanrajp M0hanrajp added the bug Something isn't working label Aug 17, 2024
@M0hanrajp
Copy link
Author

Solution:

Include a VERSION file that has string 3.x.x or the branch's release version in order to eliminate the error.

project devs/maintainers please let me know if you are also encountering this issue and we can include the
VERSION file in the device-bacnet-c repo to fix this.

Thanks

@cloudxxx8
Copy link
Member

EdgeX community normally use semver branch to retrieve the version number
https://github.com/edgexfoundry/device-bacnet-c/tree/semver

@M0hanrajp
Copy link
Author

EdgeX community normally use semver branch to retrieve the version number https://github.com/edgexfoundry/device-bacnet-c/tree/semver

Do you mean to say we need to do it manually referring to semver branch when we
encounter the error ?

could you please explain if this is an issue or it doesn't need any improvements ?

@cloudxxx8
Copy link
Member

no, I mean the build script should be able to retrieve the version number and generate the VERSION file

@git describe --abbrev=0 | sed 's/^v//' > ./VERSION

we wrote this logic in the Makefile
please try to use make build or make docker instead of executing the build.sh directly

@M0hanrajp
Copy link
Author

Using make build does eliminate the error !

I'm not sure why ./scripts/build.sh is causing

CMake Error at CMakeLists.txt:61 (FILE):
  FILE STRINGS file
  "/home/mpunix/edgex-foundry/edgex-device-sdk-c/device-bacnet-c/src/c/../../VERSION"
  cannot be read.

Please feel free to close, or we could improve bacnet README.md

@cloudxxx8
Copy link
Member

Makefile generate the VERSINO file and execute build.sh
If you directly execute build.sh, the VERSION file cannot be found

@cloudxxx8
Copy link
Member

all the repository use make build, make docker, and make test for development
https://docs.edgexfoundry.org/3.1/microservices/device/sdk/devicesdk-getting-started/GettingStartedSDK-Go/#build-your-device-service

feel free to open a PR to modify the README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants