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

disque failing to build on big-endian Debian builds #186

Open
juricast opened this issue Apr 27, 2016 · 2 comments
Open

disque failing to build on big-endian Debian builds #186

juricast opened this issue Apr 27, 2016 · 2 comments

Comments

@juricast
Copy link

juricast commented Apr 27, 2016

Hello,

disque is failing on Debian builds with following message:
job.c:791:19: error: 'sj' undeclared (first use in this function)
memrev16ifbe(&sj->num_nacks);

There is bug report here:
https://bugs.debian.org/810030

This looks like typing issue.

With following patch, package does build but later fails during tests on big endian:

--- disque-1.0~rc1.orig/src/job.c
+++ disque-1.0~rc1/src/job.c
@@ -788,8 +788,8 @@ job *deserializeJob(unsigned char *p, si
     }
     memrev32ifbe(j->delay);
     memrev32ifbe(j->retry);
-    memrev16ifbe(&sj->num_nacks);
-    memrev16ifbe(&sj->num_deliv);
+    memrev16ifbe(&j->num_nacks);
+    memrev16ifbe(&j->num_deliv);
     p += JOB_STRUCT_SER_LEN;
     len -= JOB_STRUCT_SER_LEN;

Could you please take a look?

Thank you!

Regards,
Jurica

@latinovic
Copy link

I tested the patch that Jurica had proposed.
Compilation finished successfully but build failed on testing with following log:

./runtest
Starting disque #0 at port 25000
Starting disque #1 at port 25001
Starting disque #2 at port 25002
Starting disque #3 at port 25003
Starting disque #4 at port 25004
Starting disque #5 at port 25005
Starting disque #6 at port 25006
Testing unit: 00-base.tcl
11:10:41> (init) Restart killed instances: OK
11:10:41> Cluster nodes are reachable: OK
11:10:41> Cluster nodes hard reset: OK
11:10:41> Cluster Join and auto-discovery test: OK
11:10:43> Different nodes have different IDs: OK
Testing unit: 01-faildet.tcl
11:10:43> (init) Restart killed instances: OK
11:10:43> Cluster nodes are reachable: OK
11:10:43> Cluster nodes hard reset: OK
11:10:43> Cluster Join and auto-discovery test: OK
11:10:45> Killing two nodes: OK
11:10:46> Nodes should be flagged with the FAIL flag: OK
11:10:50> Restarting two nodes: OK
11:10:50> Nodes FAIL flag should be cleared: OK
Testing unit: 02-jobs-replication.tcl
11:10:50> (init) Restart killed instances: OK
11:10:50> Cluster nodes are reachable: OK
11:10:50> Cluster nodes hard reset: OK
11:10:50> Cluster Join and auto-discovery test: OK
11:10:52> ADDJOB, single node: OK
11:10:52> ADDJOB, synchronous replication to multiple nodes: Testing 4a2000 180224
Testing 75e01000 8384512
Testing 76601000 8384512
Testing 76e00000 4194304
Testing 7721a000 65536
Testing 773df000 8192
Testing 7740c000 8192
Testing 774d1000 12288
Testing 774d8000 4096
Testing 4a2000 180224
Testing 75c01000 8384512
Testing 76401000 8384512
Testing 76c00000 4194304
Testing 770f5000 65536
Testing 772ba000 8192
Testing 772e7000 8192
Testing 773ac000 12288
Testing 773b3000 4096
Testing 4a2000 180224
Testing 76201000 8384512
Testing 76a01000 8384512
Testing 77200000 4194304
Testing 776d1000 65536
Testing 77896000 8192
Testing 778c3000 8192
Testing 77988000 12288
Testing 7798f000 4096
Testing 4a2000 180224
Testing 75a01000 8384512
Testing 76201000 8384512
Testing 76a00000 4194304
Testing 76eb9000 65536
Testing 7707e000 8192
Testing 770ab000 8192
Testing 77170000 12288
Testing 77177000 4096
Testing 4a2000 180224
Testing 75c01000 8384512
Testing 76401000 8384512
Testing 76c00000 4194304
Testing 7710d000 65536
Testing 772d2000 8192
Testing 772ff000 8192
Testing 773c4000 12288
Testing 773cb000 4096
Testing 4a2000 180224
Testing 76001000 8384512
Testing 76801000 8384512
Testing 77000000 4194304
Testing 77583000 65536
Testing 77748000 8192
Testing 77775000 8192
Testing 7783a000 12288
Testing 77841000 4096
NOREPL Timeout reached before replicating to the requested number of nodes
    while executing
"[dict get $r link] {*}$args" 
    (procedure "D" line 3)
    invoked from within
"D 0 addjob myqueue myjob 5000 replicate 3" 
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code" 
    (procedure "test" line 6)
    invoked from within
"test "ADDJOB, synchronous replication to multiple nodes" {
    set job_id [D 0 addjob myqueue myjob 5000 replicate 3]
    assert {$job_id ne {}}
    s..." 
    (file "../tests/02-jobs-replication.tcl" line 12)
    invoked from within
"source $test" 
    (procedure "run_tests" line 9)
    invoked from within
"run_tests" 
    (procedure "main" line 6)
    invoked from within
"main" 
Cleaning up...

Any ideas?

@Deni90
Copy link

Deni90 commented Jul 1, 2016

Hi,

During compilation some warnings have shown up:

In file included from job.c:37:0:
job.c: In function 'deserializeJob':
job.c:782:18: warning: passing argument 1 of 'memrev16' makes pointer from integer without a cast [-Wint-conversion]
     memrev16ifbe(j->repl);
                  ^
endianconv.h:56:34: note: in definition of macro 'memrev16ifbe'
 #define memrev16ifbe(p) memrev16(p)
                                  ^
endianconv.h:39:6: note: expected 'void *' but argument is of type 'uint16_t {aka short unsigned int}'
 void memrev16(void *p);
      ^
job.c:783:18: warning: passing argument 1 of 'memrev64' makes pointer from integer without a cast [-Wint-conversion]
     memrev64ifbe(j->ctime);
                  ^
endianconv.h:58:34: note: in definition of macro 'memrev64ifbe'
 #define memrev64ifbe(p) memrev64(p)
                                  ^
endianconv.h:41:6: note: expected 'void *' but argument is of type 'uint64_t {aka long long unsigned int}'
 void memrev64(void *p);
      ^
job.c:784:18: warning: passing argument 1 of 'memrev32' makes pointer from integer without a cast [-Wint-conversion]
     memrev32ifbe(j->etime);
                  ^
endianconv.h:57:34: note: in definition of macro 'memrev32ifbe'
 #define memrev32ifbe(p) memrev32(p)
                                  ^
endianconv.h:40:6: note: expected 'void *' but argument is of type 'uint32_t {aka unsigned int}'
 void memrev32(void *p);
      ^

After fixing the warnings the tests were passed.

The following patch fixes the build for big endian:

--- disque-1.0~rc1.orig/src/job.c
+++ disque-1.0~rc1/src/job.c
@@ -779,17 +779,17 @@ job *deserializeJob(unsigned char *p, si

     /* Deserialize the static part just copying and fixing endianess. */
     memcpy(j,p,JOB_STRUCT_SER_LEN);
-    memrev16ifbe(j->repl);
-    memrev64ifbe(j->ctime);
-    memrev32ifbe(j->etime);
+    memrev16ifbe(&j->repl);
+    memrev64ifbe(&j->ctime);
+    memrev32ifbe(&j->etime);
     if (sertype == SER_MESSAGE) {
         /* Convert back to absolute time if needed. */
         j->etime = server.unixtime + j->etime;
     }
-    memrev32ifbe(j->delay);
-    memrev32ifbe(j->retry);
-    memrev16ifbe(&sj->num_nacks);
-    memrev16ifbe(&sj->num_deliv);
+    memrev32ifbe(&j->delay);
+    memrev32ifbe(&j->retry);
+    memrev16ifbe(&j->num_nacks);
+    memrev16ifbe(&j->num_deliv);
     p += JOB_STRUCT_SER_LEN;
     len -= JOB_STRUCT_SER_LEN;


Regards,
Daniel

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