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

Broken on FreeBSD: license_hash.cc #100

Closed
yurivict opened this issue May 15, 2019 · 9 comments
Closed

Broken on FreeBSD: license_hash.cc #100

yurivict opened this issue May 15, 2019 · 9 comments

Comments

@yurivict
Copy link
Contributor

First, BSD isn't defined. I had to apply this patch:

--- main/license_hash.cc.orig   2019-05-15 21:27:05 UTC
+++ main/license_hash.cc
@@ -62,7 +62,11 @@ int GetUnameInfo(char* buffer, int bufflen)
     return 0;
 }
 
-#ifdef BSD
+#if defined(__FreeBSD__)
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
 /* bkk bsd6 compile */
 typedef unsigned int u_int;
 

Then, there is this failure:

/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:100:9: error: no matching function for call to 'sysctl'
    if (sysctl(mib, 6, buffer, &len, NULL, 0) < 0)
        ^~~~~~
/usr/include/sys/sysctl.h:1081:5: note: candidate function not viable: no known conversion from 'const char *' to 'void *' for 3rd argument; take the address of the argument with &
int     sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
        ^
/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:103:19: error: read-only variable is not assignable
    stringbuff[0] = '\0';
    ~~~~~~~~~~~~~ ^
/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:109:32: error: use of undeclared identifier 'RTM_IFINFO'
        if (ifmsg->ifm_type == RTM_IFINFO)
                               ^
/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:112:21: error: member access into incomplete type 'struct sockaddr_dl'
            if ((sdl->sdl_alen > 0) && (sdl->sdl_alen < 256))
                    ^
/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:86:12: note: forward declaration of 'sockaddr_dl'
    struct sockaddr_dl *sdl;
           ^
/usr/ports/misc/viewtouch/work/viewtouch-19.04.1/main/license_hash.cc:112:44: error: member access into incomplete type 'struct sockaddr_dl'
            if ((sdl->sdl_alen > 0) && (sdl->sdl_alen < 256))
                                           ^

@NeroBurner
Copy link
Contributor

I don't have freebsd installed. Is there a way to use use a docker image or simmilar? Is there something like travis-ci we can add to the CI?

@yurivict
Copy link
Contributor Author

You can import this FreeBSD VirtualBox appliance image into VirtualBox: https://people.freebsd.org/~yuri/FreeBSD-12-amd64.ova and then just boot the VM.

login: root password: root

pkg search {pkg} finds packages
pkg install {pkg} installs packages

Please let me know if you have any questions.

@NeroBurner
Copy link
Contributor

I found a free freebsd CI offering over at
https://cirrus-ci.org/guide/FreeBSD/

Could you open a PR with a working .cirrus-ci.yml file

@yurivict
Copy link
Contributor Author

It doesn't seem reasonable to need to run something in the cloud when it can be run locally with much smaller efforts.

This VirtualBox appliance only takes a few clicks to install and run: https://people.freebsd.org/~yuri/FreeBSD-12-amd64.ova And only one small function seems to be required to be fixed.

@NeroBurner
Copy link
Contributor

CI makes sense for me, because I don't have a BSD system and I will not check my changes for BSD by hand. But a CI for BSD would check my commits before I merge them into master

for this particular issue checking by hand would be less effort (probably), but in the long run I think CI would be better

@yurivict
Copy link
Contributor Author

Why don't you just enable a CI for FreeBSD and it will tell you what's broken once it fails?

@NeroBurner
Copy link
Contributor

that's exactly what I suggested by using cirrus-ci (specifically cirrus-ci, because it was the first solution with a free tier for open source projects I've found)

@GeneMosher
Copy link
Member

Yuri, welcome to ViewTouch. Thanks for your input here. It would be great to see ViewTouch compiling under FreeBSD. I can see multiple benefits to this and look forward to a rapid resolution of any issues that need to be addressed to make that happen. You are certainly welcome to commit any code enhancements to master which will lead to this achievement.

@yurivict
Copy link
Contributor Author

#102

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

3 participants