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

How to properly link the gflags? #22

Closed
CNLHC opened this issue Apr 12, 2020 · 6 comments · Fixed by #25
Closed

How to properly link the gflags? #22

CNLHC opened this issue Apr 12, 2020 · 6 comments · Fixed by #25

Comments

@CNLHC
Copy link
Contributor

CNLHC commented Apr 12, 2020

Building the python wheel from master branch and run gcn model will get

python train_supervised.pyTraceback (most recent call last):
  File "train_supervised.py", line 22, in <module>
    import graphlearn as gl
  File "/home/cn/research/graph/venv/lib/python2.7/site-packages/graphlearn/__init__.py", line 16, in <module>
    from graphlearn import pywrap_graphlearn as pywrap
ImportError: /home/cn/research/graph/graph-learn/built/lib/libgraphlearn_shared.so: undefined symbol: _ZN6google14FlagRegistererC1IiEEPKcS3_S3_PT_S5_

It seems that symbol _ZN6google14FlagRegistererC1IiEEPKcS3_S3_PT_S5_ (which is the mangled FlagRegisterer from gflags package ) was not found.

So, I tried to modify the Makefile and link gflags library manually, then the problem was solved.(modified line: here)

so:protobuf grpc glog gtest proto common platform service core
	@mkdir -p $(INCLUDE_DIR)
	@mkdir -p $(LIB_DIR)
	@mkdir -p $(BIN_DIR)
	$(CXX) $(CXXFLAGS) -shared $(PROTO_OBJ) $(COMMON_OBJ) $(PLATFORM_OBJ) $(SERVICE_OBJ) $(CORE_OBJ) \
		-L$(ROOT) -L$(GLOG_LIB) -L$(PROTOBUF_LIB) -L$(GRPC_LIB) -L$(GFLAGS_LIB)\
		-lglog -lprotobuf -lgrpc++ -lgrpc -lgpr -lupb -lgflags\
		-o $(LIB_DIR)/libgraphlearn_shared.so

Is this a bug or one need special way not mentioned in doc so far to link gflags ?

@patricxu
Copy link

configure glags as shared library which is not the default option!

@CNLHC
Copy link
Contributor Author

CNLHC commented Apr 13, 2020

configure glags as shared library which is not the default option!

But it seems that the default configuration do treat gflags as shared library. Am i missing something ?🤔

I will try to reproduce this problem in a brand new environment later.

@patricxu
Copy link

@CNLHC see my notes
The output of the default config is .a, but we need .so.

@CNLHC
Copy link
Contributor Author

CNLHC commented Apr 14, 2020

@CNLHC see my notes
The output of the default config is .a, but we need .so.

Obviously. In fact, I have already noticed that and done a similar job in a build script here

But i do not think this is the key point of the problem. What I concern is that do we need to compile gflags manually or not?

After testing in a brand new environment and reading your notes, i can pretty sure that the answer is yes: we do need to build gflags manually.

I will try to submit a PR to automate this process.

Thanks for your communication!

@jackonan
Copy link
Collaborator

@CNLHC Great thanks for your PR. Would you mind show your building steps and commands that lead to the errors exactly? I did not reproduce the problem in my environment.

@CNLHC
Copy link
Contributor Author

CNLHC commented Apr 20, 2020

The reproducing steps

export GL_DIR=<Graph-Learn Directory>
cd $GL_DIR
git checkout  1d024e7
make cleanall
git reset --hard
git clean -dif
make
make python
source env.sh
python -m pip install -I ./dist/graphlearn-0.1-cp27-cp27mu-linux_x86_64.whl
cd examples/tf/gcn
python train_supervised.py

then , got error

Traceback (most recent call last):
  File "train_supervised.py", line 22, in <module>
    import graphlearn as gl
  File "/home/cn/research/graph/venv/lib/python2.7/site-packages/graphlearn/__init__.py", line 16, in <module>
    from graphlearn import pywrap_graphlearn as pywrap
ImportError: /home/cn/research/graph/graph-learn/built/lib/libgraphlearn_shared.so: undefined symbol: _ZN6google14FlagRegistererC1IiEEPKcS3_S3_PT_S5_

os

NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

and kernel-version

4.15.0-88-generic

@baoleai baoleai linked a pull request Jun 3, 2020 that will close this issue
@baoleai baoleai closed this as completed Jun 3, 2020
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

Successfully merging a pull request may close this issue.

4 participants