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

>=3.1.5 doesn't build on Linux #38

Closed
hinrik opened this issue Nov 17, 2012 · 3 comments
Closed

>=3.1.5 doesn't build on Linux #38

hinrik opened this issue Nov 17, 2012 · 3 comments
Assignees

Comments

@hinrik
Copy link

hinrik commented Nov 17, 2012

Recent versions (latest git included) give this error when trying to require "lanes":

lua: error loading module 'lanes.core' from file '/home/hinrik/.luarocks/lib/lua/5.1/lanes/core.so':
    /home/hinrik/.luarocks/lib/lua/5.1/lanes/core.so: undefined symbol: pthread_mutexattr_settype
stack traceback:
    [C]: ?
    [C]: in function 'require'
    /home/hinrik/.luarocks/share/lua/5.1/lanes.lua:58: in function 'configure'
    lan-test.lua:1: in main chunk
    [C]: ?

With version 3.1.5, the build type was changed from "make" to "builtin". This causes LuaRocks to ignore the Makefile in the distribution, and consequently fail to use necessary flags such as -lpthread on Linux. lanes-3.1.4.rockspec (see 37b0d64) is the last one to build correctly (though luarocks does complain about the missing revision at the end of its version number).

Note the lack of -lpthread:

$ luarocks --local install lanes
Installing http://luarocks.org/repositories/rocks/lanes-3.1.6-1.src.rock...
Using http://luarocks.org/repositories/rocks/lanes-3.1.6-1.src.rock... switching to 'build' mode
Archive:  /tmp/luarocks_luarocks-rock-lanes-3.1.6-1-1273/lanes-3.1.6-1.src.rock
  inflating: lanes-3.1.6-1.rockspec  
   creating: lanes/
  inflating: lanes/CMakeLists.txt    
  inflating: lanes/README            
  inflating: lanes/make-vc.cmd       
  inflating: lanes/setup-vc.cmd      
  inflating: lanes/dist.info         
  inflating: lanes/COPYRIGHT         
  inflating: lanes/CHANGES           
  inflating: lanes/BUGS              
  inflating: lanes/lanes-3.1.5-1.rockspec  
  inflating: lanes/lanes-3.1.6-1.rockspec  
  inflating: lanes/ABOUT             
   creating: lanes/tests/
  inflating: lanes/tests/appendud.lua  
  inflating: lanes/tests/fibonacci.lua  
  inflating: lanes/tests/irayo_closure.lua  
  inflating: lanes/tests/objects.lua  
  inflating: lanes/tests/error.lua   
  inflating: lanes/tests/errhangtest.lua  
  inflating: lanes/tests/argtable.lua  
  inflating: lanes/tests/assert.lua  
  inflating: lanes/tests/recursive.lua  
  inflating: lanes/tests/fifo.lua    
  inflating: lanes/tests/hangtest.lua  
  inflating: lanes/tests/cyclic.lua  
  inflating: lanes/tests/require.lua  
  inflating: lanes/tests/atomic.lua  
  inflating: lanes/tests/func_is_string.lua  
  inflating: lanes/tests/linda_perf.lua  
  inflating: lanes/tests/perftest.lua  
  inflating: lanes/tests/atexit.lua  
  inflating: lanes/tests/ehynes.lua  
  inflating: lanes/tests/irayo_recursive.lua  
  inflating: lanes/tests/protectproxy.lua  
  inflating: lanes/tests/finalizer.lua  
  inflating: lanes/tests/timer.lua   
  inflating: lanes/tests/launchtest.lua  
  inflating: lanes/tests/basic.lua   
  inflating: lanes/tests/keeper.lua  
   creating: lanes/docs/
  inflating: lanes/docs/index.html   
  inflating: lanes/docs/multi.png    
  inflating: lanes/docs/Lua multithreading choices.svg  
 extracting: lanes/docs/Lua multithreading choices.graffle  
  inflating: lanes/docs/comparison.html  
  inflating: lanes/docs/performance.ods  
  inflating: lanes/dist.cmake        
  inflating: lanes/Makefile          
  inflating: lanes/TODO              
   creating: lanes/src/
  inflating: lanes/src/keeper.h      
  inflating: lanes/src/tools.c       
  inflating: lanes/src/lanes.c       
  inflating: lanes/src/keeper.c      
  inflating: lanes/src/lanes-keeper.lua  
  inflating: lanes/src/lanes.lua     
  inflating: lanes/src/tools.h       
  inflating: lanes/src/threading.c   
  inflating: lanes/src/threading.h   
  inflating: lanes/src/Makefile      
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/lanes.c -o src/lanes.o -Isrc
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/keeper.c -o src/keeper.o -Isrc
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/tools.c -o src/tools.o -Isrc
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/threading.c -o src/threading.o -Isrc
gcc -shared -o lanes/core.so -L/usr/local/lib src/lanes.o src/keeper.o src/tools.o src/threading.o
Updating manifest for /home/hinrik/.luarocks/lib/luarocks/rocks

lanes 3.1.6-1 is now built and installed in /home/hinrik/.luarocks/ (license: MIT/X11)
@benoit-germain
Copy link
Member

You can you give a shot to the following changes to the rockspec until I get the time to commit them. Juste replace the entire build table as follows:

build = {
    type = "builtin",
    platforms =
    {
        linux =
        {
            modules =
            {
                ["lanes.core"] =
                {
                    libraries = "pthread"
                },
            }
        }
    },
    modules =
    {
        ["lanes.core"] =
        {
            sources = { "src/lanes.c", "src/keeper.c", "src/tools.c", "src/threading.c"},
            incdirs = { "src"},
        },
        lanes = "src/lanes.lua"
    }
}

Then you can check it works with
luarocks --local make <rockspec>

@ghost ghost assigned benoit-germain Nov 20, 2012
@hishamhm
Copy link

I tested this and it works. I submitted a new revision to the repository:

http://luarocks.org/repositories/rocks/lanes-3.1.6-2.rockspec

@hinrik
Copy link
Author

hinrik commented Nov 20, 2012

Yep. It works.

@hinrik hinrik closed this as completed Nov 20, 2012
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