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

undefined reference to `jl_n_threads' on Windows #6

Closed
aminya opened this issue Nov 30, 2019 · 13 comments
Closed

undefined reference to `jl_n_threads' on Windows #6

aminya opened this issue Nov 30, 2019 · 13 comments

Comments

@aminya
Copy link
Contributor

aminya commented Nov 30, 2019

When running test/ccalls.jl

test.o: In function `call':

C:\Users\travis\.julia\packages\Cassette\YCOeN\src/context.jl:447: undefined reference to `jl_n_threads'

collect2.exe: error: ld returned 1 exit status

https://travis-ci.com/tshort/StaticCompiler.jl/jobs/261775338#L137

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

Caused by unsafe_load() in f()

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

By removing unsafe_load() we get:
image

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

Happens when the shell command runs.
image

@tshort
Copy link
Owner

tshort commented Nov 30, 2019

Interesting. I thought jl_n_threads would be universal. There's probably another function that will suffice for this test. Will have to look.

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

It is not just this one. Running
test/globals.jl
gives a lot of similar errors:
image

@tshort
Copy link
Owner

tshort commented Nov 30, 2019

Interesting. Must be a deeper bug. I can look, but probably not for a couple of days.

@tshort
Copy link
Owner

tshort commented Nov 30, 2019

I think the problem is that the macro jlrun cannot find libjulia. It should try to link to lib/libjulia.dll.a. It has a different name on Linux (and probably MacOS, too). This line probably needs to splice in a different library name, depending on the platform.

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

I addressed this in the PR now, but still doesn't work.

@tshort
Copy link
Owner

tshort commented Nov 30, 2019

I played around with this locally for a bit and couldn't find a gcc command that would work.

@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

There are some stuff to test from the documentation:
https://docs.julialang.org/en/v1/manual/embedding/#

@tshort
Copy link
Owner

tshort commented Nov 30, 2019

I hate compiling on Windows. Looks like it might be an ordering issue (hint here). So, the compile statement needs to have test.o -ljulia.dll instead of -ljulia.dll test.o.

aminya added a commit to aminya/StaticCompiler.jl that referenced this issue Nov 30, 2019
@aminya
Copy link
Contributor Author

aminya commented Nov 30, 2019

image
Yay, I think it is solved

@aminya aminya closed this as completed Dec 2, 2019
@aminya
Copy link
Contributor Author

aminya commented Dec 2, 2019

Closed by aminya@64ef80b

tshort pushed a commit that referenced this issue Dec 3, 2019
* Adding Windows definition for :Sleep

Fixes #2

* Checking for gcc installation

* Runcommand based on OS

* Minor code formatting

* Travis Windows and Julia 1.3

* Appveyor Julia 1.3

* Moving function definition out of testset macro

* Add @JLrun test for f1,f2,f3

* verify generated IR for f()

* First checking gcc installation

* Separate libname for windows and linux

* better libdir and bindir

* Adding includedir

* adding julia bindir to path on windows

* Ordering issue

should solve 
#6 (comment)

* Test dep

* [skip ci] minor formatting

* includedir removal

#3 (comment)

* libname removal

#3 (comment)

* Adding Julia to the path removal

* formatting using JuliaFormatter

* gitignore:
test.o
test.so
test.bc
/standalone/*

* Windows support in the readme

* Fixes #5

* jl_erno instead of usleep

https: //github.com//pull/3#discussion_r352372588
Co-Authored-By: Tom Short <tshort.rlists@gmail.com>

* Another deprecation fix

 Fixes #5

* Full Cmap

* Full cformat map

* Fixes for standalone exe on Windows

Co-Authored-By: Tom Short <tshort.rlists@gmail.com>

* commenting duplicates in Cmap

* Bug fix attempt

* Shellcmd based on OS

* OS specific path handeling

* correct standalone dir

* formatting

* [skip ci] Remove trailing spaces
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

2 participants