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

Making demo7 fails #10

Open
buddha314 opened this issue Apr 27, 2018 · 4 comments
Open

Making demo7 fails #10

buddha314 opened this issue Apr 27, 2018 · 4 comments

Comments

@buddha314
Copy link
Collaborator

In examples/demo7/server I translated the Makefile to

#MODULES= /home/marcos/projects/chapel/projects/chrest/src
CHREST_HOME=$(HOME)/git/chrest
MODULES= -M$(CHREST_HOME)/src
INCLUDES= -I$(CHREST_HOME)/src 
CC=chpl
EXEC=srv

default: src/srv.chpl 
	chpl -o ./bin/$(EXEC)  $(MODULES) $(INCLUDES) -lwebsockets $(CHREST_HOME)/src/chrest_websocket.c $<

run: default
	./bin/$(EXEC)

so it would run on my system. I installed libevent-dev and libwebsocket-dev' then did make and got

chpl -o ./bin/srv  -M/home/buddha/git/chrest/src -I/home/buddha/git/chrest/src  -lwebsockets /home/buddha/git/chrest/src/chrest_websocket.c src/srv.chpl
In file included from /tmp/chpl-buddha-11541.deleteme/chpl__header.h:6:0,
                 from /tmp/chpl-buddha-11541.deleteme/_main.c:2:
/usr/include/ev.h:220:3: error: expected identifier before numeric constant
   EV_READ     =            0x01, /* ev_io detected read will not block */
   ^
In file included from /tmp/chpl-buddha-11541.deleteme/_main.c:49:0:
/tmp/chpl-buddha-11541.deleteme/ChrestWebsockets.c: In function ‘Publish_chpl’:
/tmp/chpl-buddha-11541.deleteme/ChrestWebsockets.c:768:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl19 = lws_get_protocol((coerce_tmp_chpl11)->wsi_chpl);
                 ^
In file included from /tmp/chpl-buddha-11541.deleteme/_main.c:49:0:
/tmp/chpl-buddha-11541.deleteme/ChrestWebsockets.c: In function ‘chest_pubsub_websocket_callback’:
/tmp/chpl-buddha-11541.deleteme/ChrestWebsockets.c:1596:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl7 = lws_get_protocol(wsi);
                ^
/home/buddha/git/chapel/runtime/etc/Makefile.exe:27: recipe for target '/tmp/chpl-buddha-11541.deleteme/srv.tmp' failed
make[1]: *** [/tmp/chpl-buddha-11541.deleteme/srv.tmp] Error 1
error: compiling generated source
Makefile:9: recipe for target 'default' failed
make: *** [default] Error 1

Latest version of Chapel.

@buddha314
Copy link
Collaborator Author

After working with marcos, seems like a slightly new error

ddha@ubuddha:~/git/chrest/examples/demo7/server$ make
chpl -o ./bin/srv  -M/home/buddha/git/chrest/src -I/home/buddha/git/chrest/src  -lwebsockets /home/buddha/git/chrest/src/chrest_websocket.c src/srv.chpl
In file included from /tmp/chpl-buddha-16316.deleteme/_main.c:49:0:
/tmp/chpl-buddha-16316.deleteme/ChrestWebsockets.c: In function ‘Publish_chpl’:
/tmp/chpl-buddha-16316.deleteme/ChrestWebsockets.c:768:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl19 = lws_get_protocol((coerce_tmp_chpl11)->wsi_chpl);
                 ^
In file included from /tmp/chpl-buddha-16316.deleteme/_main.c:49:0:
/tmp/chpl-buddha-16316.deleteme/ChrestWebsockets.c: In function ‘chest_pubsub_websocket_callback’:
/tmp/chpl-buddha-16316.deleteme/ChrestWebsockets.c:1596:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl7 = lws_get_protocol(wsi);
                ^
mv: cannot move '/tmp/chpl-buddha-16316.deleteme/srv.tmp' to './bin/srv': No such file or directory
/home/buddha/git/chapel/runtime/etc/Makefile.exe:27: recipe for target '/tmp/chpl-buddha-16316.deleteme/srv.tmp' failed
make[1]: *** [/tmp/chpl-buddha-16316.deleteme/srv.tmp] Error 1
error: compiling generated source
Makefile:9: recipe for target 'default' failed
make: *** [default] Error 1

@marcoscleison
Copy link
Owner

marcoscleison commented Apr 30, 2018

We are experimenting a conflict between the libwebsockets from Ubuntu and the lastest libwebsocket used in chapel.
I could reproduce this issue installing libwebsockets-dev from apt-get.
To solve I did:

  1. Remove libwebsockets-dev
sudo apt purge libwebsockets-dev
  1. Go to the demo7 and try to compile and run it.
cd examples/demo7/server
make run

You should have this output:

In file included from /tmp/chpl-marcos-3236.deleteme/_main.c:49:0:
/tmp/chpl-marcos-3236.deleteme/ChrestWebsockets.c: In function ‘Publish_chpl’:
/tmp/chpl-marcos-3236.deleteme/ChrestWebsockets.c:983:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl22 = lws_get_protocol((coerce_tmp_chpl9)->wsi_chpl);
                 ^
/tmp/chpl-marcos-3236.deleteme/ChrestWebsockets.c: In function ‘chest_pubsub_websocket_callback’:
/tmp/chpl-marcos-3236.deleteme/ChrestWebsockets.c:1846:16: warning: assignment discards ‘const’ qualifier from pointertarget type [-Wdiscarded-qualifiers]
 call_tmp_chpl9 = lws_get_protocol(wsi);
                ^
./bin/srv
(Server starting at , 127.0.0.1, :, 8080)
GET: Registering uri /test pattern ^/test$
[2018/04/30 16:22:26:2880] NOTICE: Creating Vhost 'default' port 8000, 2 protocols, IPv6 off

It is a Warning. But the server runs without core dump.

If it is running you can go to http://localhost:8080 with the browser and see the websocket receiving and sending data. The demo is nothing beautify but serves for the propose.
The websocket listens at port 8000

If after removing libwebsockets-dev with apt-get, you experiments errors like "libwebsockets not found", you should compile libwebsocket from sources:

git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
mkdir build
cd build
cmake ..
make
sudo make install

@buddha314
Copy link
Collaborator Author

I removed libwebsockets and rebuilt from source. Now I get

buddha@ubuddha:~/git/chrest/examples/demo7/server$ make run
chpl -o ./bin/srv  -M/home/buddha/git/chrest/src -I/home/buddha/git/chrest/src  -lwebsockets /home/buddha/git/chrest/src/chrest_websocket.c src/srv.chpl
In file included from /tmp/chpl-buddha-18600.deleteme/_main.c:49:0:
/tmp/chpl-buddha-18600.deleteme/ChrestWebsockets.c: In function ‘Publish_chpl’:
/tmp/chpl-buddha-18600.deleteme/ChrestWebsockets.c:768:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl19 = lws_get_protocol((coerce_tmp_chpl11)->wsi_chpl);
                 ^
In file included from /tmp/chpl-buddha-18600.deleteme/_main.c:49:0:
/tmp/chpl-buddha-18600.deleteme/ChrestWebsockets.c: In function ‘chest_pubsub_websocket_callback’:
/tmp/chpl-buddha-18600.deleteme/ChrestWebsockets.c:1596:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 call_tmp_chpl7 = lws_get_protocol(wsi);
                ^
./bin/srv
./bin/srv: error while loading shared libraries: libwebsockets.so.12: cannot open shared object file: No such file or directory
Makefile:12: recipe for target 'run' failed
make: *** [run] Error 127

@marcoscleison
Copy link
Owner

Try to compile libwebsockets from the sources.

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