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

Problem compiling in MacOS #1

Open
mariambrites opened this issue Dec 31, 2021 · 2 comments
Open

Problem compiling in MacOS #1

mariambrites opened this issue Dec 31, 2021 · 2 comments

Comments

@mariambrites
Copy link

When compiling the code in MacOS using the makefile I obtain the the following error:

mkdir -p build/./src/
g++ -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -c src/scientisst.cpp -o build/./src/scientisst.cpp.o -lbluetooth
clang: warning: -lbluetooth: 'linker' input unused [-Wunused-command-line-argument]
src/scientisst.cpp:20:11: fatal error: 'bluetooth/bluetooth.h' file not found
 #include <bluetooth/bluetooth.h>
          ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [build/./src/scientisst.cpp.o] Error 1

After commenting the #ifdef HASBLUETOOTH block in lines 20-24:

#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <stdlib.h>

I also obtain the following errors:

mkdir -p build/./src/
g++ -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -c src/scientisst.cpp -o build/./src/scientisst.cpp.o -lbluetooth
clang: warning: -lbluetooth: 'linker' input unused [-Wunused-command-line-argument]
src/scientisst.cpp:138:18: error: use of undeclared identifier 'hci_get_route'
    int dev_id = hci_get_route(NULL);
                 ^
src/scientisst.cpp:139:16: error: use of undeclared identifier 'hci_open_dev'
    int sock = hci_open_dev(dev_id);
               ^
src/scientisst.cpp:143:5: error: unknown type name 'inquiry_info'
    inquiry_info ii[MAX_DEVS];
    ^
src/scientisst.cpp:144:5: error: unknown type name 'inquiry_info'
    inquiry_info *pii = ii;
    ^
src/scientisst.cpp:146:64: error: use of undeclared identifier 'IREQ_CACHE_FLUSH'
    int num_rsp = hci_inquiry(dev_id, 8, MAX_DEVS, NULL, &pii, IREQ_CACHE_FLUSH);
                                                               ^
src/scientisst.cpp:343:7: error: unknown type name 'sockaddr_rc'
      sockaddr_rc so_bt;
      ^
src/scientisst.cpp:344:25: error: use of undeclared identifier 'AF_BLUETOOTH'
      so_bt.rc_family = AF_BLUETOOTH;
                        ^
src/scientisst.cpp:350:19: error: use of undeclared identifier 'AF_BLUETOOTH'
      fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
                  ^
src/scientisst.cpp:350:33: error: use of undeclared identifier 'SOCK_STREAM'
      fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
                                ^
src/scientisst.cpp:350:46: error: use of undeclared identifier 'BTPROTO_RFCOMM'
      fd = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
                                             ^
src/scientisst.cpp:354:30: error: unknown type name 'sockaddr'
      if (connect(fd, (const sockaddr*)&so_bt, sizeof so_bt) != 0)
                             ^
11 errors generated.
make: *** [build/./src/scientisst.cpp.o] Error 1

After commenting the two other #ifdef HASBLUETOOTH blocks, in lines 136-171 and lines 342-363, I also obtain the following:

mkdir -p build/./src/
g++ -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -I./src -g -std=c++11 -DHASBLUETOOTH -Wall -c src/scientisst.cpp -o build/./src/scientisst.cpp.o -lbluetooth
clang: warning: -lbluetooth: 'linker' input unused [-Wunused-command-line-argument]
g++ ./build/./src/esp_adc.cpp.o ./build/./src/scientisst.cpp.o ./build/./src/main.cpp.o -o scientisst -lbluetooth
ld: library not found for -lbluetooth
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [scientisst] Error 1

Finally, after commenting LDFLAGS = -lbluetooth in the makefile, I'm able to compile

@francis2tm
Copy link
Collaborator

And does the program work correctly if you comment everything you said above?

@mariambrites
Copy link
Author

mariambrites commented Jan 3, 2022

No, after that I still have the old loss of communication problem:

Connecting to device - /dev/tty.eforto-df-6e
Connected to device. Press Enter to exit.
RIP
ScientISST exception: The computer lost communication with the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants