Re: sem_open / how to use NPTL?
Viktor Horvath wrote:
Hello everybody,
forgive me for bothering you, but after hours and hours of searching, I'm
stuck. For my university, I've to program some easy things with POSIX.4
semaphores. I know that I need kernel 2.6 and NPTL for that, and I have
kernel 2.6.7, gcc 3.3.5 and libc6-i686 well installed. But a minimal
program, shown below, compiled with "gcc -o minimal -lpthread minimal.c"
keeps saying "sem_open: function not implemented" as if I were still using
old LinuxThreads. However, getconf says:
<snip>
So I run Sarge with the 2.6.9 kernel to which all the Debian patches are
applied plus 2 more, Ruby (multiseat Linux) and vesafb-tng (better vesafb).
Then:
ii gcc 3.3.4-2 The GNU C compiler
ii libc6 2.3.2.ds1-16 GNU C Library: Shared libraries and
Timezone
ii g++-3.2 3.2.3-9 The GNU C++ compiler
My g++ link is set to the latter.
So I copied your minimal c and created my own Makefile (I use qmake from
Qt). I'll put that at the end.
Then I compiled:
make
which gave:
g++ -Wl,-rpath,/usr/doc/qt-x11-free-3.3.1/lib -o modposix modposix.o
-L/usr/doc/qt-x11-free-3.3.1/lib -L/usr/X11R6/lib -lpthread -lqt -lXext
-lX11 -lm
Ignore the Qt stuff, it won't matter. Compiled flawlessly. I hate to say
WFM but so it is ;-)
The only thing that I changed is your title line:
### minimal.c
I eliminated it because g++ threw a tizzy.
It is something with the 2.6.7 of yours?
HTH
H
Makefile follows:
#############################################################################
# Makefile for building: modposix
# Generated by qmake (1.07a) (Qt 3.3.1) on: Wed Dec 15 07:10:53 2004
# Project: modposix.pro
# Template: app
# Command: $(QMAKE) -o Makefile modposix.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -w -O2 -DQT_NO_DEBUG
CXXFLAGS = -pipe -w -O2 -DQT_NO_DEBUG
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I/usr/doc/qt-x11-free-3.3.1/mkspecs/default -I.
-I$(QTDIR)/include
LINK = g++
LFLAGS = -Wl,-rpath,$(QTDIR)/lib
LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lpthread -lqt
-lXext -lX11 -lm
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS =
SOURCES = modposix.cpp
OBJECTS = modposix.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST = modposix.pro
QMAKE_TARGET = modposix
DESTDIR =
TARGET = modposix
first: all
####### Implicit rules
.SUFFIXES: .c .o .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)
$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )
Makefile: modposix.pro
/usr/doc/qt-x11-free-3.3.1/mkspecs/default/qmake.conf
$(QMAKE) -o Makefile modposix.pro
qmake:
@$(QMAKE) -o Makefile modposix.pro
dist:
@mkdir -p .tmp/modposix && $(COPY_FILE) --parents $(SOURCES) $(HEADERS)
$(FORMS) $(DIST) .tmp/modposix/ && ( cd `dirname .tmp/modposix` &&
$(TAR) modposix.tar modposix && $(GZIP) modposix.tar ) && $(MOVE)
`dirname .tmp/modposix`/modposix.tar.gz . && $(DEL_FILE) -r .tmp/modposix
mocclean:
uiclean:
yaccclean:
lexclean:
clean:
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)
FORCE:
####### Compile
modposix.o: modposix.cpp
####### Install
install:
uninstall:
Reply to: