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

Compile on Ubuntu 18.04 Server #447

Closed
heruan opened this issue Aug 3, 2018 · 12 comments
Closed

Compile on Ubuntu 18.04 Server #447

heruan opened this issue Aug 3, 2018 · 12 comments

Comments

@heruan
Copy link

@heruan heruan commented Aug 3, 2018

I'm on the Ubuntu 18.04.1 Server image for Rasberry Pi 2 provided by Ubuntu here and I'm trying to compile CoovaChilli as described in http://coova.github.io/CoovaChilli/DistroBuilding/

This is the output of debuild -b (only the error part):

libtool: compile:  arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I. -I.. -I../json -D_GNU_SOURCE -Wall -Werror -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -funroll-loops -pipe -I../bstring -DDEFCHILLICONF=\"/etc/chilli.conf\" -DDEFPIDFILE=\"/var/run/chilli.pid\" -DDEFSTATEDIR=\"/var/run\" -DSBINDIR=\"/usr/sbin\" -I../json -DDEFLIBDIR=\"/usr/lib/coova-chilli\" -MT ms_chap.lo -MD -MP -MF .deps/ms_chap.Tpo -c ms_chap.c  -fPIC -DPIC -o .libs/ms_chap.o
ms_chap.c: In function ‘MakeKey’:
ms_chap.c:99:3: error: implicit declaration of function ‘des_set_odd_parity’; did you mean ‘DES_set_odd_parity’? [-Werror=implicit-function-declaration]
   des_set_odd_parity((des_cblock *)des_key);
   ^~~~~~~~~~~~~~~~~~
   DES_set_odd_parity
ms_chap.c:99:23: error: ‘des_cblock’ undeclared (first use in this function); did you mean ‘DES_cblock’?
   des_set_odd_parity((des_cblock *)des_key);
                       ^~~~~~~~~~
                       DES_cblock
ms_chap.c:99:23: note: each undeclared identifier is reported only once for each function it appears in
ms_chap.c:99:35: error: expected expression before ‘)’ token
   des_set_odd_parity((des_cblock *)des_key);
                                   ^
ms_chap.c: In function ‘DesEncrypt’:
ms_chap.c:105:3: error: unknown type name ‘des_cblock’; did you mean ‘DES_cblock’?
   des_cblock  des_key;
   ^~~~~~~~~~
   DES_cblock
ms_chap.c:106:3: error: unknown type name ‘des_key_schedule’; did you mean ‘DES_key_schedule’?
   des_key_schedule key_schedule;
   ^~~~~~~~~~~~~~~~
   DES_key_schedule
ms_chap.c:108:16: error: passing argument 2 of ‘MakeKey’ makes pointer from integer without a cast [-Werror=int-conversion]
   MakeKey(key, des_key);
                ^~~~~~~
ms_chap.c:88:1: note: expected ‘u_char * {aka unsigned char *}’ but argument is of type ‘int’
 MakeKey(u_char *key, u_char *des_key)
 ^~~~~~~
ms_chap.c:109:3: error: implicit declaration of function ‘des_set_key’; did you mean ‘DES_set_key’? [-Werror=implicit-function-declaration]
   des_set_key(&des_key, key_schedule);
   ^~~~~~~~~~~
   DES_set_key
ms_chap.c:110:3: error: implicit declaration of function ‘des_ecb_encrypt’; did you mean ‘DES_ecb_encrypt’? [-Werror=implicit-function-declaration]
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
   ^~~~~~~~~~~~~~~
   DES_ecb_encrypt
ms_chap.c:110:20: error: ‘des_cblock’ undeclared (first use in this function); did you mean ‘DES_cblock’?
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
                    ^~~~~~~~~~
                    DES_cblock
ms_chap.c:110:32: error: expected expression before ‘)’ token
   des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
                                ^
cc1: all warnings being treated as errors
Makefile:938: recipe for target 'ms_chap.lo' failed
make[4]: *** [ms_chap.lo] Error 1
make[4]: Leaving directory '/home/ubuntu/src/coova-chilli/src'
Makefile:981: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/ubuntu/src/coova-chilli/src'
Makefile:417: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/ubuntu/src/coova-chilli'
Makefile:345: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/ubuntu/src/coova-chilli'
debian/rules:34: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
debuild: fatal error at line 1152:
dpkg-buildpackage -rfakeroot -us -uc -ui -b failed

Am I missing some dependency? Or maybe a library version mismatch?

@yoanbosch
Copy link

@yoanbosch yoanbosch commented Sep 4, 2018

Hi, did you manage to find a solution to your issue? I am getting he same errors except I'm using a PC with Ubuntu 18.04

@heruan
Copy link
Author

@heruan heruan commented Sep 4, 2018

Not yet, unfortunately; I was hoping for a feedback from the maintainers.

@heruan heruan changed the title Compile on Ubuntu 18.04 Server for ARMHF (Raspberry) Compile on Ubuntu 18.04 Server Sep 4, 2018
@yoanbosch
Copy link

@yoanbosch yoanbosch commented Sep 4, 2018

Hi, the problem is OpenSSL 1.1 - CoovaChilli needs OpenSSL 1.0

apt install openssl1.0
mv /usr/bin/openssl /root/
ln -s /usr/lib/ssl1.0/openssl /usr/bin/openssl
apt remove libssl-dev
apt install libssl1.0-dev

@heruan
Copy link
Author

@heruan heruan commented Sep 5, 2018

Thank you @yoanbosch for the workaround. I'll leave this open to keep track on updating CoovaChilli to OpenSSL 1.1.

@heruan
Copy link
Author

@heruan heruan commented Sep 5, 2018

I'll just add that this command is sufficient for a successful build:

$ sudo apt install libssl1.0-dev

No need to install openssl1.0, nor to move or link binaries.

@norterj
Copy link

@norterj norterj commented Mar 27, 2019

I'll just add that this command is sufficient for a successful build:

$ sudo apt install libssl1.0-dev

No need to install openssl1.0, nor to move or link binaries.

Hello
does anyone have successfully compile and create deb package in Ubuntu 18.04?

I've compiled before in 16.04 and need for compilation the following packages:
build-essential libtool openssl libcurl3 libssl-dev libcurl4-openssl-dev libc-ares-dev libc-ares2 gengetopt debhelper libjson0-dev haserl m4 automake subversion devscripts

When I try to install them on 18.04 I have the following problems:

  • libjson0-dev doesn't exist anymore (or I couln't find), I tried with libjson-c-dev
  • libcurl3 : Conflicts: libcurl4, so I change with libcurl4
  • libcurl4-openssl-dev conflicts with libssl1.0-dev, so when I try to install the system removes that package, and as you comment before, libssl1.0-dev its need or else it doesn't compile successfully.

Anyone has suggestions?

@Philippe2705
Copy link

@Philippe2705 Philippe2705 commented Apr 4, 2019

HI !
If anyone has this issue and 'sudo apt install libssl1.0-dev' didn't helped, the following solved my issue:
go to the build_dir/target-xxxx/coova-chilli-xxxx/src
And open ms_chap.c as root.

  • Replace des_set_odd_parity by DES_set_odd_parity
  • Replace des_cblock by DES_cblock
  • Replace des_key_schedule by DES_key_schedule
  • Replace des_set_key(&des_key, key_schedule) by DES_set_key(&des_key, &key_schedule)
  • Replace des_ecb_encrypt by DES_ecb_encrypt
    And I think it is all.
@norterj
Copy link

@norterj norterj commented Apr 5, 2019

Thanks Philippe2705!!
That almost work!!!

The final "catch" for the ones compiling this is:

  • pay attention on &key_schedule on "Replace des_set_key(&des_key, key_schedule) by DES_set_key(&des_key, &key_schedule)" , in the original file the & is not there
  • the same thing on "Replace des_ecb_encrypt by DES_ecb_encrypt", in the end should look like DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, &key_schedule, 1);

In the end it works like charm!
Once again thanks for your help Philippe2705!!

HI !
If anyone has this issue and 'sudo apt install libssl1.0-dev' didn't helped, the following solved my issue:
go to the build_dir/target-xxxx/coova-chilli-xxxx/src
And open ms_chap.c as root.

* Replace des_set_odd_parity by DES_set_odd_parity

* Replace des_cblock by DES_cblock

* Replace des_key_schedule by DES_key_schedule

* Replace des_set_key(&des_key, key_schedule) by DES_set_key(&des_key, &key_schedule)

* Replace des_ecb_encrypt by DES_ecb_encrypt
  And I think it is all.
@heruan
Copy link
Author

@heruan heruan commented Apr 8, 2019

@sevan Any chance for an upcoming 1.5 (or 2.0?) release with up-to-date libraries?

timwhite added a commit to GraseHotspot/coova-chilli that referenced this issue Aug 3, 2019
@timwhite
Copy link

@timwhite timwhite commented Aug 3, 2019

Thanks @Philippe2705 and @norterj
The patch for others trying at home is as follows:

diff --git a/src/ms_chap.c b/src/ms_chap.c
index 2c236d2..8ad8327 100644
--- a/src/ms_chap.c
+++ b/src/ms_chap.c
@@ -96,18 +96,18 @@ MakeKey(u_char *key, u_char *des_key)
   des_key[6] = Get7Bits(key, 42);
   des_key[7] = Get7Bits(key, 49);
 
-  des_set_odd_parity((des_cblock *)des_key);
+  DES_set_odd_parity((DES_cblock *)des_key);
 }
 
 static void /* IN 8 octets IN 7 octest OUT 8 octets */
 DesEncrypt(u_char *clear, u_char *key, u_char *cipher)
 {
-  des_cblock           des_key;
-  des_key_schedule     key_schedule;
+  DES_cblock           des_key;
+  DES_key_schedule     key_schedule;
 
   MakeKey(key, des_key);
-  des_set_key(&des_key, key_schedule);
-  des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
+  DES_set_key(&des_key, &key_schedule);
+  DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher, &key_schedule, 1);
 }
 
 #define LENGTH 20
@timwhite
Copy link

@timwhite timwhite commented Aug 3, 2019

It also seems this is fixed in #329 (db57030) so you should be able to just cherry-pick that commit if you need

@sevan
Copy link
Member

@sevan sevan commented Nov 24, 2019

Try v1.5

@sevan sevan closed this Dec 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants